BusyContacts to OmniFocus – AppleScript
I also created a script that takes the currently selected BusyContacts contact and creates a task in OmniFocus.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
(* Create an OmniFocus task in the OF Inbox from BusyContacts that has a link back to the contact, such as busycontacts://show/B9F0F65A-40C5-42E7-A75A-C830BFB56E2E -- (c) 2018 Matthias Nott *) use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions -- -- Configuration -- property mFile : "Ablage" -- Menu Item: File property mFileCardURL : "Karten-URL" -- Menu Item: File - Card URL property mEdit : "Bearbeiten" -- Menu Item: Edit property mFileCopyCard : "Karte kopieren" -- Menu Item: Edit - Copy Card property quickEntry : true -- use Quick Entry -- -- Main Program -- on run set crt to ASCII character 13 -- -- Get the Back Link -- tell application "System Events" to tell process "BusyContacts" set frontmost to true click (menu item 1 where its name starts with mFileCardURL) of menu 1 of menu bar item mFile of menu bar 1 end tell delay 0.5 set theURL to the clipboard set theURL to ("" & theURL & crt & crt) -- -- Get the Contact Data -- tell application "System Events" to tell process "BusyContacts" set frontmost to true click (menu item 1 where its name starts with mFileCopyCard) of menu 1 of menu bar item mEdit of menu bar 1 end tell delay 0.5 set theContact to the clipboard set theName to top(theContact) -- -- Make the OmniFocus Task -- makeOmniFocusTask("Contact: " & theName, crt & crt & theURL & theContact, quickEntry) end run -- -- Get the first line of a text -- to top(txt) set tid to AppleScript's text item delimiters set AppleScript's text item delimiters to ASCII character 10 -- (a line feed) set line1 to item 1 in paragraphs of txt set AppleScript's text item delimiters to tid return line1 end top -- -- Make an OmniFocus Task -- on makeOmniFocusTask(theTitle, theNote, isQuick) tell application "OmniFocus" if (isQuick = true) then tell quick entry set theTask to make new inbox task with properties ¬ {name:theTitle, note:theNote} open end tell else tell default document set theTask to make new inbox task with properties ¬ {name:theTitle, note:theNote} end tell end if end tell set theTaskID to "omnifocus:///task/" & id of theTask return theTaskID end makeOmniFocusTask |
Comments
So empty here ... leave a comment!