The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Parse & paste Lotus Notes Doclink into OmniFocus action note (http://forums.omnigroup.com/showthread.php?t=5939)

WillR 2007-11-29 01:11 PM

Parse & paste Lotus Notes Doclink into OmniFocus action note
 
I now have several of my friends hooked on OF. Unfortunately we all work at a company that uses Lotus Notes for email. The problem is not Lotus Notes (it works fine). It is that we need a way to tie our Lotus Notes email and teamroom documents into OF. There is a way that we see to do this but I think it needs some Applescript or smarts built into OF to handle it right.

Notes has a concept of a Doclink. It is a way for the Notes client to copy link to an existing document and paste it into a text field in another document. It works great within Notes and some other applications also understand what do to with Doclinks in their app. Mindjet Mindmanager is a good example of this. We would like OF to take the Doclink off the OS X clipboard and paste it into note field of the action.

Today if you paste it into the note field in an Action, it will look like this:

Will's Mail - OmniFocus & Lotus Notes
<NDL>
<REPLICA 852370F9:00757C27>
<VIEW OF37D46BF5:E8F08834-ON852564B5:00129B2C>
<NOTE OF877C97B2:1462232F-ON862573A2:0066B1EE>
<HINT>CN=ServerA/O=MyOrg</HINT>
<REM>Database 'Will's Mail', View 'Inbox', Document 'OmniFocus & Lotus Notes'</REM>
</NDL>

Contained within that text is enough information to construct a Notes URL that OF and most browsers understand. That URL for the above link would look like this:

Notes:///852370F900757C27/37D46BF5E8F08834852564B500129B2C/877C97B21462232F862573A20066B1EE

After the "Notes://" the rest of the information is pulled from the REPLICA, VIEW and NOTE lines above. You strip out the ":" that appear in the line and for the VIEW and NOTE lines, you pull leading "OF" and "-ON" halfway through the string. Take those results and separate them by a slash "/" and you are done. OF will properly launch that URL from within the note field in the action.

If we had the Notes URL instead of the doclink text, we could tie our actions back to Lotus Notes via the link that we could click on.

Other info like the source (Will's mail inbox) and email title (OmniFocus & Lotus Notes) are there for the taking as well.

So our plea is can someone who knows Applescript can give us a script that parses what is on the clipboard, opens a new action and pastes in a usable Notes URL (Notes://). This would help OF by providing a great tie to Lotus Notes and make it easier to leverage that user base. All Mac Lotus Notes users could then use OF to manage both their work life (mostly in Lotus Notes) and personal stuff.

Of course if Omni could do the parse on the paste like Mindjet, that would be even cooler.

Any takers to help out there?

sssouder 2007-11-29 02:47 PM

Fantastic idea!
 
I, too, work for a company who's centered most of its business -- and business processes -- on Lotus Notes. We also have a rising population of Mac users who are GTD converts and are anxiously awaiting the shipment of OmniFocus.

I can't think of a more innovative integration point than what WillR describes above. Please...someone jump on this one!

Tim Wood 2007-11-29 04:58 PM

Does Notes support Mac OS X Services? If you select text in Notes and use the clipping shortcut, does anything happen?

WillR 2007-11-29 05:29 PM

It doesn't look like Lotus Notes 7.0.3 supports Mac OS X Services
 
Apparently Notes doesn't support Mac OS X Services since all it does is beep at me. If I try the keystroke from other applications, it works fine. :-(

fudster 2007-12-03 08:10 PM

I have this working fairly well here. Thanks for ChuckieMac for his "cutof" URL handler app/script, and curt.clifton for help with modifying the script.

I think there are a half dozen ways to do this, and this probably isn't the best - but it's the first one that I got working. :-)

I'm using Notes 7.0.2 on Mac OS X 10.4.11. Firefox is my default browser.

1) go [URL="http://mcphate.org/mt/2007/08/copy_url_to_omnifocus.html"]here[/URL], download the .dmg, and follow all the instructions for creating a bookmarklet. See [URL="http://forums.omnigroup.com/showthread.php?t=4510"]here[/URL] for the origins of this app.

2) Due to some changes in the OmniFocus script support, we need make a change/fix to ChuckieMac's script. In Finder, go to Applications, and right-click on Copy URL to OmniFocus. Choose "Display Contents", and navigate further to Contents/Resources/Scripts. Open main.scpt in Script Editor. Replace the 'tell application "OmniFocus"' section in the middle with the following:

[CODE]
tell application "OmniFocus"
tell quick entry
activate
set newTask to make new inbox task with properties {name:("capture: " & theTitle), note:theAddress}
select {inbox task 1}
end tell
-- to capture without using the Quick Entry dialog, use this code instead:
--tell default document
-- make new inbox task with properties {name:("capture: " & theTitle), note:theAddress}
--end tell

end tell
[/CODE]

At this point you will have a bookmarklet in firefox, and your Mac will be configured to use ChuckieMac's app/script to create OmniFocus actions in response to "cutof" URL clicks.

3) In Lotus Notes, select from the Lotus Notes menu, "Preferences -> Toolbar Preferences". Select "Customize" on the left. Select New -> Button. Fill in the following:

- Button caption text: "capture to omnifocus"
- Select a suitable icon (choose a small one. I'm not thrilled with any of them - I chose the pointy-finger pointing at the globe).
- enter the following code for the formula, then click the Checkmark and OK. Do whatever else is necessary so that the new button appears where you desire on your Notes toolbar. Associate a hotkey if you can and desire - I'd like to do this as well, but I haven't.
[CODE]
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.};

urlDatabase := @LowerCase( "notes://" + @URLEncode("Domino";serverNameCommon) + "/" + @WebDbName );

urlView := @LowerCase( urlDatabase + "/" + @URLEncode("Domino";@Subset(@ViewTitle;-1)) );

urlDocument := @LowerCase( urlDatabase + "/0/" + @Text(@DocumentUniqueID) );

serverNameCommonEncoded := @URLEncode("Domino";@LowerCase(serverNameCommon));

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) ) :
(urlDocument) :

("(db) " + databaseTitle + " - " + urlDatabase) :
(urlDatabase) :

("(view) " + databaseTitle + " - " + urlView) :
(urlView) :

@If( Form=""; ""; ("(doc) " + documentTitle + " - " + urlDocumentDNS) ) :

("(db) " + databaseTitle + " - " + urlDatabaseDNS) :

("(view) " + databaseTitle + " - " + urlViewDNS)

));

REM {Display the Dialog Box};

REM {@Prompt([OkCancelEditCombo]; dialogTitle; dialogMessage; @Subset(dialogChoices;1); dialogChoices)};

@URLOpen("cutof://===="+urlDocument+"===="+documentTitle)
[/CODE]
- note: the preceeding code was originally written to present a dialog, with choices for Notes DB, View, and document - the selected choice could be copied to the clipboard. If this is desired you can un-comment the appropriate lines in the script and get rid of the OpenURL line.
- Also, I have tried to find the original author who freely contributed this script so I can give them credit, but I couldn't find them. I will credit him/her when I determine who the author was.

If everything went right, clicking on the new toolbar button should bring up the OF Quick Entry window with a new task. Command-apostrophe should open the Content of the task, and a notes: URL should be there.

One slightly annoying thing is that when you click the icon, Firefox (if it is your default browser) is launched and a blank page appears - web browser is launched, and the web browser in turn launches the script.

WillR 2007-12-05 01:42 PM

Thanks fudster. It took a bit of juggling but I got it working. A little Applescript training for me I guess. I used your instructions but had to make a change to the OF section. I used this instead:

tell front document of application "OmniFocus"
make new inbox task with properties {name:("capture: " & theTitle), note:theAddress}
end tell

I would still like see tighter linkage with OF understanding and parsing a Notes DocLink but this will work for me. I am off to organize my Notes life.

Thanks again for the help.

fudster 2007-12-10 12:18 PM

Hey WillR, you're welcome!

I'm also very new to AppleScript, so I'm not surprised you were able or required to make some improvements.

Unfortunately, Notes 7.x on Mac is a port at best, and is not a well behaved Mac app. It does, or fails to do, many things that are very annoying, especially for folks that are accustomed to proper Mac apps. So I'm not shocked that there is no Applescript support (actually I never even bothered to check).

But, like you, I must use Notes and I'm glad to be able to run it on my Mac. I'm particularly happy to have this capture working, even if it's a little kludgy - some sort of OF capture from Notes is crucial for me. Before I got this working, I was copy/pasting Notes URLs into OF (and previously, iGTD). (yuk)

I am looking forward to Notes 8.0 on Mac, which I think is going to be released fairly early in the new year (I hope). I think it relies on Eclipse (Rich Client Platform I think), so the the extent that Eclipse is Mac-proper, it should be possible for Notes to be Mac-proper too. I'm not holding my breath for Applescript support, but I'm certain that Notes 8 on Mac (or any platform for that matter) will be better than any 7.x.x., and as long as it still supports minimal URL launching (which it will), this mechanism should work at least as good as it does now.


All times are GMT -8. The time now is 10:46 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.