I also created a script that takes the currently selected BusyContacts contact and creates a task in OmniFocus.
(*
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
This is great. Had to figure out the File menu translations to make it work on my Mac, but it is basically exactly what I was looking for.
Now if only it could also append a note in BusyContacts whenever the OF task is completed !
MANY THANKS indeed for sharing the script.
Ah ha .. this is exactly what I was looking for. Will give it a go tomorrow …