Sunday, December 4, 2022

#1 2022-11-07 01:54:10 pm

sp73
Member
Registered: 2022-11-07
Posts: 1

Add Document to Omnifocus Script Reporting Error

I am new to scripting; most of what I do is modify something existing for my own purposes. For example, I am trying to use MacSparky"s script to add a document to Omnifocus but so far I only get an error message, even when running it unmodified.

What I want to do is have Hazel scan a document for certain properties to determine if the script should be applied. If so, then it runs the following:

set theDate to current date
set theTask to "Pay Property Taxes"

Applescript:


tell application "OmniFocus"
   tell front document
       set theContext to first flattened tag where its name = "taxes"
       set theProject to first flattened project where its name = "Bills"
       tell theProject to make new task with properties {name:theTask, context:theContext}
   end tell
end tell

I get this as the result:

Result:
error "OmniFocus got an error: Can’t make {name:\"Pay Property Taxes\", context:tag id \"e7up0S0J9zI\" of default document} into type properties of task." number -1700 from {name:"Pay Property Taxes", context:tag id "e7up0S0J9zI" of default document}

Help is appreciated!

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)