iterate thru all current Inbox items
Trying to write an Applescript that will ( in the background) iterate thru all Inbox items, and pop up Growl notifications (I have that part of the code, just need help with Omnifocus inbox part). I would schedule thru Lingon X for this run say every 5min or so.
Reason is now with Mail Drop, I have a lot of stuff hitting my OF Inbox, and would like to see some Growl'dge :-) to remind me about it. I've seen sample code for how to get a selected item from the inbox, but not to traverse all inbox items. I understand the repeat over a list concept, I just can't figure out the lexicon to iterate over the inbox list. |
To visit all the actions in the Inbox, (iterating only through the leaves, and skipping their parent group nodes, if there is any indentation), you could write, for example, something like:
[CODE]tell application id "OFOC" tell default document set lstInboxLeaves to flattened tasks where in inbox is true and number of tasks = 0 repeat with oTask in lstInboxLeaves set strName to name of oTask end repeat end tell end tell[/CODE] |
Thanks Rob!
|
FWIW if you just want a textual list of the items, you can get it directly without a loop.
[CODE]property pPrefix : "- " tell application id "OFOC" tell default document set {dlm, my text item delimiters} to {my text item delimiters, linefeed & pPrefix} set strList to pPrefix & (name of flattened tasks where in inbox is true and number of tasks = 0) as string set my text item delimiters to dlm strList end tell end tell[/CODE] |
(Tho by the time you are doing that you might as well use a shell command line
[CODE]sqlite3 -separator " " ~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2 ' select "-", name from task where effectiveinInbox=1 and childrenCount=0'[/CODE] which is faster, and doesn't require OF to be running). |
All times are GMT -8. The time now is 08:54 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.