To add a button to the Notes toolbar which copies a notes:// style link to the current document to the clipboard
- Go to File -> Preferences -> Toolbar -> Customise
- Click New -> Button...
- Set fields as follows:
Caption text - "Notes: Link"
Popup help "Copy 'notes:' link to clipboard"
Formula:
serverNameAbb := @Name([Abbreviate];@Subset(@DbName;1));
serverNameCommon := @Name([CN];@Subset(@DbName;1));
serverDNSName := @DbLookup(""; "":"names.nsf"; "Connections"; serverNameAbb; "OptionalNetworkAddress"; [FailSilent]);
REM {For server names that contain spaces, always use the DNS name instead, because notes:// links do not work when the server name contains spaces.};
serverNameCommon := @If( @Contains(serverNameCommon;" "); serverDNSName; serverNameCommon );
REM {Database, View and Document url links.};
serverNameCommonEncoded := @URLEncode("Domino";@LowerCase(serverNameCommon));
urlDatabase := @LowerCase( "notes://" + @URLEncode("Domino";serverNameCommon) + "/" + @WebDbName );
urlView := @LowerCase( urlDatabase + "/" + @URLEncode("Domino";@Subset(@ViewTitle;-1)) );
urlDocument := @LowerCase( urlDatabase + "/0/" + @Text(@DocumentUniqueID) );
urlDatabaseDNS := @ReplaceSubstring(urlDatabase; serverNameCommonEncoded; serverDNSName);
urlViewDNS := @ReplaceSubstring(urlView; serverNameCommonEncoded; serverDNSName);
urlDocumentDNS := @ReplaceSubstring(urlDocument; serverNameCommonEncoded;serverDNSName);
REM {Additional text to appear in the dialog box.};
databaseTitle := @Subset(@DbTitle;1);
documentTitle := @If( Title != ""; Title; Subject != ""; Subject; databaseTitle);
REM {Dialog Box messages};
dialogTitle := "Lotus Notes URL";
dialogMessage := "Press Ctrl-C to copy this URL.";
REM {Choices to appear in Dialog Box};
dialogChoices :=
@Unique(@Trim(
@If( Form=""; ""; ("(doc) " + documentTitle + " - " + urlDocument) ) :
("(db) " + databaseTitle + " - " + urlDatabase) :
("(view) " + databaseTitle + " - " + urlView)
));
REM {Display the Dialog Box};
@Prompt([OkCancelEditCombo]; dialogTitle; dialogMessage; @Subset(dialogChoices;1); dialogChoices)
- Change the icon to something appropriate, I usethis one:
- Finally, add the button to a toolbar which is widely used (e.g. Universal).
Thanks to
Alex Lepofsky for this.
No comments:
Post a Comment