I’ve created a guide to using AppleScript with OmniFocus 3:
I’m sure this is incomplete, so please feel free to submit pull requests.
I’ve created a guide to using AppleScript with OmniFocus 3:
I’m sure this is incomplete, so please feel free to submit pull requests.
Obviously I’m new to AppleScript; I made this before learning that AppleScript Dictionaries are things that exist, and that all this info and more is already in the OmniFocus AppleScript Dictionary.
I would say this is a useful adjunct so thank you!
Yes, it’s useful because you included some example syntax and at any rate, I’m sure it helped you learn, too.
Great work! Thanks!
Very helpful! Thanks 😃
You go over how to create a new tag, but how do I add a already existing tag(s) to a task/project? I feel like this should be easy but I’m stuck 😓
set theTask to (first flattened task where its name is "Task Name")
set theTag to (first flattened tag where its name is "Tag Name")
add theTag to tags of theTask
Thank you! Appreciate it 😊 One other question: how do you specify a folder (or a subfolder) to put a project/task in?
Hi, hoping for some help even though it is old thread.
Looking to put a task into an existing project.
This is not working, getting an error.
set theProject to first flattened project where its name is "MHProject Name"
Any help would be appreciated.
Assuming you have a project named “MHProject Name”; could you check if this works ?
tell application "OmniFocus"
tell default document
set theProject to first flattened project where its name is "This Week"
end tell
end tell
@unlocked2412 much appreciation.
Well, can’t believe it. Getting a working answer in the thread that’s over three years old so quickly.
It helped me to understand that the root object for flattened projects is default document
.
Also, I am using Script Debugger and I was able to see that some of my projects had an extra space after the name and that was causing a problem.
Thanks again
Steven
You’re welcome, @menashehertz
Got help through this thread and thought I might try again.
Is there a way of updating a task using the URL link?
tell application "OmniFocus"
try
tell content of front document window of default document to set MyTask to the value of every selected tree
tell default document
set MyTaskURL to theURL
set MyxTask to GetURL MyTaskURL
set docWindow to make new document window
close docWindow
set docWindow to make new document window
set theResult to mark complete item 1 of MyTask
-- end tell
end tell
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
theURL
contains the URL link .
Is this suppose to work? It doesn’t always work for me.
No, but you can certainly use the id
property of the Task
class to target a specific task (the URL you are describing is built using that id
).
Thanks again @unlocked2412
So if I use URL of the task by
GetURL MyTaskURL
which the documentation says
Open a document from an UR
How then can I update the status to complete using
set theResult to mark complete ...
Thanks
Why don’t you use the id
property of the Task
class ? Tell me a bit more about your use case.