I’m trying to make an AppleScript that loops through each flagged item and literally says it out loud with VoiceOver. I’ve been working on this for two days and still have not found a solution. Granted: I am a noob when it comes to AppleScripting. Any help is much appreciated! Thanks in advance!
Very rough attempt at this (but hopefully it helps get you on the right track!) →
tell application id "com.omnigroup.OmniFocus2"
tell front document
set flaggedTasks to ((name of flattened tasks where completed is false and blocked = false and flagged = true) as string)
end tell
say flaggedTasks
end tell
Thank you Steve. That works great – lightyears better than anything I could come up with! I will try and adjust it so that it hesitates in between tasks, perhaps with the delay verb.
So, not really sure what I was thinking, but the delay strategy does not work. As of right now this kind of just sounds like a stream of syllables.
Is there any way to put a pause in between each task without changing the contents of the task itself?
Put the set in to a list …
set flaggedTasks … (( ) as list)
… and use a repeat with a delay
repeat with theTask in flaggedTasks
say (theTask as text)
delay …
end repeat
–
JJW
Thank you @DrJJWMac and @steve_s, I’m very impressed with the quick and helpful responses! Storing the tasks as an array was what I originally tried, but forgot about the “as text” part. This is what my final script looked like for anyone interested:
tell application "OmniFocus"
tell front document
set flaggedTasks to ((name of flattened tasks where completed is false and blocked = false and flagged = true) as list)
end tell
say "Your objectives today are as follows."
repeat with theTask in flaggedTasks
say (theTask as text)
delay 1
end repeat
end tell