EagleFiler to OmniFocus AppleScript
I really like EagleFiler. I use it for many things, one of them being the storage of stuff that I want to read later, typically when browsing the web or checking my RSS feeds. At the stroke of a key, EagleFiler downloads a web archive of the article that I'll be able to read later on, maybe when I am offline.
The thing is, since about a week ago, I'm never offline anymore: I now have an iPhone! (I was surprised to discover that it was easier to get an iPhone than to have ADSL, due to a mix-up by the phone company. I'm still waiting to be connected. In the meantime, the iPhone is a blessing.) So I wanted a way to access all these web archives from my new toy. But as I'm online all the time now, I just need the URLs. So I needed to extract them from a list of records in EagleFiler, and somehow get them into the iPhone.
As I may have pointed earlier, I am also an OmniFocus user. I recently switched to the "sneaky peaks" of OmniFocus 1.1 that offer synchronization between computers and with the iPhone version of the application. This seemed the perfect target for the list of URLs: create one task for every record with a link to the page, click and read it on the iPhone using Mobile Safari, and check the task when done, putting it away. It was time to mobilize my inexistent yet rusty AppleScript skills to do the job!
Getting the data out of EagleFiler was not too difficult, as there is a good set of AppleScript examples. Getting the data into OmniFocus was a bit more involved, and I finally decided to create a string representing the list of tasks to import them. (I'm using the textual representation that OmniFocus understands, see the "Processing Mail messages into actions" Section of the OmniFocus manual.)
So here is the result, it's fairly simple, but as it may be useful to others (and to the future me when I'll have forgotten everything about AppleScript, this wonderful read-only programming language).
tell application "EagleFiler" set _records to selected records of browser window 1 tell library document 1 set _tasks to "" repeat with _record in _records set _name to _record's name set _url to _record's source URL set _tasks to (_tasks & return & "-- Read " & _name & "> To Read and Watch @ Read Online" & return & _url) end repeat end tell end tell tell application "OmniFocus" tell default document parse tasks with transport text _tasks end tell end tell