I am trying to add a variable to David Sparks applescript, which creates a new task with Hazel (http://macsparky.com/blog/2012/8/applescript-omnifocus-tasks?rq=Create%20omnifocus )that would add a flag to the newly created task. I have been trying various options but to no avail and would appreciate some help. Thank you. Philippe
Here’s a modified version of the script you linked to that creates a flagged task by adding flagged:true to the properties of the task created:
set theDate to current date
set theTask to "Pay Life Insurance"
set theNote to "Lovingly Scanned by your Mac on " & (theDate as string)
tell application "OmniFocus"
tell front document
set theContext to first flattened context where its name = "Haushalt"
set theProject to first flattened project where its name = "Routine Morgen"
tell theProject to make new task with properties {name:theTask, note:theNote, context:theContext, flagged:true}
end tell
end tell