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 Today's Posts

 
How to select? Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Thanks for the help, that solved it. Select certainly is picky. I rewrote the sample with some additional explanation, and added selecting an action. If you only want to select a project or folder, leave out the 'tell content' block.

NOTE: code assumes there is a task in a project that is directly in the Library (not in a folder).
Code:
tell application "OmniFocus"
	tell default document
		-- example: get a reference to an action (task in Applescript) and its parent project
		set project1 to first project whose status is active
		set task1 to task 1 of project1 whose completed is false
		
		tell front document window
			-- The parent project of an action (task) must be selected before you can select the action.
			tell sidebar -- to select a project or folder, you must tell the sidebar
				select {project1} --must be a list
			end tell
			tell content -- to select an action, you must tell the content
				select {task1} --must be a list
				--The focus may be on the sidebar or the content, select doesn't change it.
				--The following should change focus to the content area:
				set selected to true -- bug in OmniFocus: doesn't work
			end tell
		end tell
	end tell
end tell
The bug that you can't get or set the selected property of the content or sidebar of a window is also shown.

I wrote OFSelectAny() to make it easier to select:
http://forums.omnigroup.com/showthread.php?t=11886

Last edited by davidamis; 2009-04-08 at 06:16 PM.. Reason: added link to OFSelectAny() post
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Select behind artdog OmniGraffle General 3 2010-09-09 02:50 AM
Select from one item to another? Roger Barre OmniOutliner 3 for Mac 0 2008-09-07 09:38 AM
How to select all level n vanity OmniOutliner 3 for Mac 6 2008-01-25 12:31 PM
How to *just* select a Project? santra OmniFocus 1 for Mac 12 2007-10-05 04:26 AM
non-linear select bjordan OmniOutliner 3 for Mac 1 2007-08-09 11:23 AM


All times are GMT -8. The time now is 06:55 AM.


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