2009/01/19

A button to make it simpler to paste notes: urls

I often paste links to Lotus Notes documents (mostly mail messages) in my tiddlywikis. Creating a toolbar button that puts the notes: url in a field makes it simpler. Unfortunately, LotusScript does not provide a way to access the clipboard, so you have to manually select the text and copy it there.
Create a new toolbar button and paste this code inside:


dn := @Subset(@DbName; 1);
linkType:= "Document";
nsfPath := @WebDbName;
qualifiedHost := @If(@Length(dn) = 0; ""; @DbLookup("":""; dn:"names.nsf"; "($ServersLookup)"; dn; "SMTPFullHostDomain"));
dbUrl := "Notes://" + qualifiedHost+ "/" + nsfPath;
viewUrl := dbUrl + "/";
docUrl := viewUrl + "/" + @Text(@DocumentUniqueID);
docTitle := @If(@IsAvailable(Subject);Subject;@IsAvailable(Title);Title;@IsAvailable(FullName);FullName;@Name([CN];@Author));
clipboardTxt := "[[" + docTitle + "|" + docUrl + "]]";
@Prompt([OkCancelEdit]; "TiddlyWiki link"; "Copy the text below to the clipboard."; clipboardTxt)

I posted this long ago in my intranet blog, and looks that can also be useful outside. The code was adapted from something that Jonathan Feinberg, of Wordle fame, wrote for a then young and great Dogear, a bookmarking service that ended up being one of the key components of Lotus Connections.