Applescript, Omnifocus & Transmit

I've been using Omnifocus now for about 3 months, after struggling to find a good system to keep track of what I'm doing. It's pretty perfect. Except for one thing. It's not web based, and the only mobile app it has is for the iPhone. So I can't access anything on my lists unless I have my computer with me. So, I was daydreaming one day and wondering how I could take a list, and put it online so I could (for instance) go to the grocery store and see exactly what I need to get, and mark off what I put in my cart. Sure I could print it off, but sometimes I can't do that. And sure, I could use their HTML export, but they don't have check boxes on them so I can't check off what I've done.

So long story short, I instead decided to spend a good 4 hours, learn a bit of Applescript, and create a nifty Applescript which exports an Omnifocus list to custom html with check boxes next to each item (see an example here), and automatically uploads it via FTP in Transmit... all in the click of a button.

Anyways, for anyone who could actually make use of this, here's what I've got:

on run
    tell application id "com.omnigroup.OmniFocus" to tell default document
        set PP to project "Grocery Print list" in folder "Personal"
        set pptasks to every task of PP where completed is false
    end tell
    set f to ((path to desktop as text) & "omni.html")
    set nref to open for access file f with write permission
    write "
<title>Omnifocus export - " & (current date) & " </title>
        <link href='style.css' media='screen' rel='stylesheet' type='text/css' />
<div id='container'>
<div class='title'>
    <h1>Omnifocus Applescript Export</h1>
    " & (current date) & "
<ul>" to file f
    repeat with ot in pptasks
        set testVars to name of ot
        write "<li><label><input type='checkbox' />" & testVars & "</label></li>" to file f
    end repeat
    write "
</html>" to file f
    close access nref
    tell application "Transmit"
        set myFave to item 1 of (favorites whose name is "")
        set myRules to (skip rules whose name is "New Rule")
        tell current tab of (make new document at end)
            connect to myFave
            tell local browser
                change location to path "~/Desktop"
            end tell
            tell remote browser
                upload item at path "~/Desktop/omni4.html" to "public_html/omni" with resume mode overwrite
            end tell
            close remote browser
        end tell
    end tell
end run
blog comments powered by Disqus