The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
iterate thru all current Inbox items Thread Tools Search this Thread Display Modes
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
 
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
 
(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'
which is faster, and doesn't require OF to be running).
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -8. The time now is 12:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.