Skip to content

Instantly share code, notes, and snippets.

@matellis
Last active July 18, 2017 01:35

Revisions

  1. Mat Ellis revised this gist Apr 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion AirmailToOmnifocus2.scpt
    Original file line number Diff line number Diff line change
    @@ -53,7 +53,7 @@ try
    end if
    end tell
    else
    tell default document to make new inbox task with properties {name:my_subject, note:message_url}
    tell default document to make new inbox task with properties {name:message_subject, note:message_url}
    end if
    end tell

  2. Mat Ellis revised this gist Apr 1, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions AirmailToOmnifocus2.scpt
    Original file line number Diff line number Diff line change
    @@ -48,8 +48,8 @@ try
    keystroke "'" using command down
    keystroke (key code 123)
    else
    keystroke (ASCII character 31)
    keystroke "e" using command down
    keystroke (ASCII character 31)
    keystroke "e" using command down
    end if
    end tell
    else
  3. Mat Ellis revised this gist Apr 1, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion AirmailToOmnifocus2.scpt
    Original file line number Diff line number Diff line change
    @@ -48,7 +48,8 @@ try
    keystroke "'" using command down
    keystroke (key code 123)
    else
    -- keystroke tab ? how do we get into Subject?
    keystroke (ASCII character 31)
    keystroke "e" using command down
    end if
    end tell
    else
  4. Mat Ellis created this gist Apr 1, 2014.
    60 changes: 60 additions & 0 deletions AirmailToOmnifocus2.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    (*
    Send currently selected Airmail message to OmniFocus 2 quick entry box, then archive it.
    Based on http://simplicitybliss.com/add-last-sent-email-to-omnifocus
    and http://discourse.omnigroup.com/t/mail-to-quick-entry-applescript/500
    To install:
    - Create a new Automator Service
    - Cut/paste this into it
    - Edit properties to your satisfaction
    - Save as "Send to Omnifocus"
    - Create a keyboard shortcut in Preferences (I use F6) to link to a hot key
    Enjoy!
    *)

    -- Open OmniFocus Quick Entry window (true) or add the task silently to the OmniFocus Inbox (false)?
    property ShowQuickEntry : true

    -- Archive the message or not?
    property ArchiveMessage : true

    -- When showing the quick entry box, leave the cursor in the note instead of the subject?
    property PutCursorInNote : false

    try
    tell application "AirMail Beta"
    set message_subject to the subject of the selected message
    set message_url to the selectedMessageUrl

    if ArchiveMessage then
    tell application "AirMail Beta"
    activate
    tell application "System Events" to tell process "Airmail Beta" to keystroke "e"
    end tell
    end if

    tell application "OmniFocus"
    if ShowQuickEntry then
    tell quick entry
    make new inbox task with properties {name:message_subject, note:message_url}
    open
    activate
    end tell
    tell application "System Events"
    if PutCursorInNote then
    keystroke (ASCII character 31)
    keystroke "'" using command down
    keystroke (key code 123)
    else
    -- keystroke tab ? how do we get into Subject?
    end if
    end tell
    else
    tell default document to make new inbox task with properties {name:my_subject, note:message_url}
    end if
    end tell

    end tell
    end try