10Dec/064
Toolbar Functions 1.3.0
There are two new functions (Document Edit & Document Open) with this release. I also updated the screencast explaining all of the functions. Thanks Johan for the new functions.
Here are the current options:
- Agent Run
- Agent Run Current
- Database Path
- Database Replica ID
- Database Server
- Database Server & Path
- Document Edit
- Document Open
- Edit Profile Document
- Formula Evaluate
- Get Environment Value
- Link Message
- Note ID
- Parent UNID
- Refresh Selected Documents
- Set Environment Value
- Undo Replication Conflict
- Unlock Document
- UNID
- Workflow Formula Test
Toolbar Functions 1.3.0 Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | REM {Toolbar Functions 1.3.0 by Chad Schelfhout.}; REM {Visit http://www.chadsmiley.com/ToolbarFunctions for the latest updates}; REM {Constants}; ProfileName := "ChadSmiley Tools"; ToolbarToolsLastSelection := "ToolbarToolsLastSelection"; ToolbarToolsLastProfile := "ToolbarToolsLastProfile"; ToolbarToolsLastEnvironmentVariable := "ToolbarToolsLastEnvironmentVariable"; ToolbarToolsLastFormula := "ToolbarToolsLastFormula"; DefaultSelection := "Undo Replication Conflict"; cSemicolonReplace := "#SC#"; REM {Get last selection for this database}; ToolbarToolsSelection := @GetProfileField( ProfileName ; ToolbarToolsLastSelection ; @UserName ) ; Option := @Prompt( [OkCancelCombo] ; "Select Option" ; "What would you like to do:" ; @If( ToolbarToolsSelection = "" ; DefaultSelection ; ToolbarToolsSelection ) ; @Explode( "Undo Replication Conflict:Unlock Document:Refresh Selected Documents:Link Message:Workflow Formula Test:Agent Run:Agent Run Current:Note ID:UNID:Parent UNID:Database Replica ID:Database Path:Database Server:Database Server & Path:Edit Profile Document:Get Environment Value:Set Environment Value:Formula Evaluate:Authors:Document Edit:Document Open" ; ":" ) ) ; REM {Set last selection for this database}; @SetProfileField( ProfileName ; ToolbarToolsLastSelection ; Option ; @UserName ) ; @If( Option = "Refresh Selected Documents" ; @Command([ToolsRefreshSelectedDocs]) ; Option = "Undo Replication Conflict" ; @Do( @SetField("$REF" ; @DeleteField ) : @SetField( "$Conflict" ; @DeleteField ) ); Option = "Unlock Document" ; @Do( @SetField("$Writers" ; @DeleteField ) ; @SetField("$PWriters" ; @DeleteField ) ; @SetField( "$WritersDate" ; @DeleteField ) ) ; Option = "Agent Run" ; @Do ( @Command([RunAgent] ; @Prompt( [OkCancelEdit];"Run Agent" ; "Enter agent to run"; "" ) ) ) ; Option = "Agent Run Current" ; @Do ( @Command([ToolsRunMacro]; $Title) ) ; Option = "Link Message" ; @Do ( @Command([Compose]; @MailDbName; "Bookmark") ) ; Option = "Edit Profile Document" ; @Do ( @SetProfileField( ProfileName ; ToolbarToolsLastProfile ; @Trim( @Unique( @Prompt([OkCancelEditCombo]; "Open Profile Document"; "Profile Document Name (There should be a corresponding form or suborm)"; @Subset( @Explode( @GetProfileField( ProfileName ; ToolbarToolsLastProfile ; @UserName ) ; ";" ) ;1 ) ; @Explode( @GetProfileField( ProfileName ; ToolbarToolsLastProfile ; @UserName ) ; ";" ) ) : @GetProfileField( ProfileName ; ToolbarToolsLastProfile ; @UserName ) ) ); @UserName ) ; @Command([EditProfile] ; @Text( @Subset( @Explode( @GetProfileField( ProfileName ; ToolbarToolsLastProfile ; @UserName ) ; ";" ) ;1 ) ) ; @If( @Prompt( [YesNo] ; "Personal Profile" ; "Is '" + @Subset( @Explode( @GetProfileField( ProfileName ; ToolbarToolsLastProfile ; @UserName ) ; ";" ) ;1 ) + "' a personal profile?" ) ; @UserName ; "" ) ) ); Option = "Get Environment Value" ; @Do ( CurrentEnvVariable := @GetProfileField( ProfileName ; ToolbarToolsLastEnvironmentVariable ; @UserName ) ) : @Set( "NewEnvVariable" ; @Prompt([OkCancelEditCombo]; "Get Environment Value"; "Enter the name of the environment variable:"; @Subset( CurrentEnvVariable ; 1 ); CurrentEnvVariable ) ) : @SetProfileField( ProfileName ; ToolbarToolsLastEnvironmentVariable ; @Trim( @Unique( NewEnvVariable : CurrentEnvVariable ) ); @UserName ) : @Prompt([OkCancelEdit]; "Environment Value"; "The value of the evironment variable '" + NewEnvVariable + "':" ; @Environment( NewEnvVariable ) ); Option = "Set Environment Value" ; @Do ( CurrentEnvVariable := @GetProfileField( ProfileName ; ToolbarToolsLastEnvironmentVariable ; @UserName ) ) : @Set( "NewEnvVariable" ; @Prompt([OkCancelEditCombo]; "Set Environment Value"; "Enter the name of the environment variable:"; @Subset( CurrentEnvVariable ; 1 ); CurrentEnvVariable ) ) : @SetProfileField( ProfileName ; ToolbarToolsLastEnvironmentVariable ; @Trim( @Unique( NewEnvVariable : CurrentEnvVariable ) ); @UserName ) : @SetEnvironment( NewEnvVariable ; @Prompt([OkCancelEdit]; "Environment Value"; "The new value of the evironment variable '" + NewEnvVariable + "':" ; @Environment( NewEnvVariable ) ) ); Option = "Parent UNID" ; @Do ( @Prompt([OkCancelEdit]; "Parent UNID"; "Parent Unique ID"; @Text($REF)) ) ; Option = "UNID" ; @Do ( @Prompt([OkCancelEdit]; "UNID"; "Unique ID"; @Text(@DocumentUniqueID)) ) ; Option = "Database Replica ID" ; @Do ( @Prompt([OkCancelEdit]; "Database Replica ID"; "Database Replica ID"; @Text(@ReplicaID)) ) ; Option = "Database Path" ; @Do ( @Prompt([OkCancelEdit]; "Database Path"; "Database Path"; @Text(@Subset( @DbName ; -1 ) ) ) ) ; Option = "Database Server" ; @Do ( @Prompt([OkCancelEdit]; "Database Server"; "Database Server"; @Text(@Subset( @DbName ; 1 ) ) ) ) ; Option = "Database Server & Path" ; @Do ( @Prompt([OkCancelEdit]; "Database Server & Path"; "Database Server & Path"; @Text( @Implode( @DbName ; "!!" ) ) ) ) ; Option = "Note ID" ; @Do ( @Prompt([OkCancelEdit]; "Note ID"; "Note ID"; @Text(@NoteID)) ) ; Option = "Formula Evaluate" ; @Do ( CurrentForumla := @GetProfileField( ProfileName ; ToolbarToolsLastFormula ; @UserName ) ) : @Set( "NewFormula" ; @Prompt([OkCancelEditCombo]; "Formula to Evaluate"; "Enter the formula to evaluate:"; @ReplaceSubstring( @Subset( CurrentForumla ; 1 ) ; cSemicolonReplace ; ";" ); @ReplaceSubstring( CurrentForumla ; cSemicolonReplace ; ";" ) ) ) : @SetProfileField( ProfileName ; ToolbarToolsLastFormula ; @Trim( @Unique( @ReplaceSubstring( NewFormula ; ";" ; cSemicolonReplace ) : CurrentForumla ) ); @UserName ) : @Prompt([OkCancelEdit]; "Formula Evaluated"; "The evaluate result:" ; @Implode( @Text( @Eval ( NewFormula ) ) ) ); Option = "Workflow Formula Test" ; @Do ( @Command([Compose]; @DbName; "(OS FormulaTest)") ) ; Option = "Authors" ; @Do ( @Prompt([OkCancelEdit]; "Authors"; "List of people/groups that have author access to document:"; @Implode( @Name( [Abbreviate]; @Author ) ; "," ) ) ) ; Option = ("Document Open":"Document Edit" ) ; @If( @Unique(@Text(@DocumentUniqueID)) = @Repeat("0"; 32 ) ; @Prompt( [Ok]; "Unable to Continue"; "A document needs to be selected.") ; @Do( host:=@DbLookup("":""; @Subset(@DbName; 1) : "names.nsf"; "($Servers)"; @Subset(@DbName; 1); "SMTPFullHostDomain" ; [FailSilent] ); host:=@If(@IsError(host) ; "localhost" ; host ); normalMode:=@DbLookup("":""; @Subset(@DbName; 1) : "names.nsf"; "($Servers)"; @Subset(@DbName; 1); "HTTP_NormalMode" ; [FailSilent] ); normalMode:=@If(@IsError(normalMode) ; "1" ; normalMode ); port:=@DbLookup("":""; @Subset(@DbName; 1) : "names.nsf"; "($Servers)"; @Subset(@DbName; 1); "HTTP_Port" ; [FailSilent] ); port:=@If(@IsError(port) ; "80" ; port ); sslPort:=@DbLookup("":""; @Subset(@DbName; 1) : "names.nsf"; "($Servers)"; @Subset(@DbName; 1); "HTTP_SSLPort" ; [FailSilent] ); sslPort:=@If(@IsError(port) ; "443" ; port ); prefix:=@If( normalMode = "1" | normalMode = "2" ; "http"; "https" ); portSuffix:=@If( prefix = "http" & port = 80; ""; prefix = "https" & sslPort = "443"; ""; prefix = "http"; ":" + @Text(port); prefix = "https"; ":" + @Text(sslPort); "" ); @URLOpen(prefix + "://" + host + portSuffix + "/" + @WebDbName + "/0/" + @Text(@DocumentUniqueID) + "?" + @If( Option = "Document Open" ; "OpenDocument" ; "EditDocument" ) ) ) ) ; "" ) |
January 8th, 2007 - 02:47
thanks a lot for sharing this pearl! a real time/life saver
January 15th, 2008 - 11:29
Hi,
I add a option to count the number of elements in a given multi value field.
here the formula:
Option = “Number of Elements” ; @Do ( @Prompt([Ok]; “Number of Elements” ; @Text( @Elements( @GetField( @Prompt( [OkCancelEdit];”Field Name” ; “Enter field name”; “” ) ) ) ) + ” Elements in field” ) ) ;
October 17th, 2008 - 04:07
Hi Chad,
This is a great tool, its simple and very powerful.
One suggestion though:
Can you create a version which does not add profile documents to the dbs.
The last used command is more of a nice to have feature for me, and one which I am ready to give up.
May be you can create an environment variable instead (and just remember the absolute last command)
Thanks again for this, its fantastic…
November 14th, 2008 - 07:50
Sounds like a nice option I will see what I can do.