View Single Post
Quote:
Originally Posted by kingsinger View Post
.. move selected projects to the top of the project list
Might look something like this:

Code:
property pTitle : "Move selected projects to top"
property pVer : "0.3"

tell application id "OFOC"
	tell front document
		-- GET A LIST OF THE PROJECTS SELECTED IN THE GUI
		tell front document window
			repeat with oPanel in {sidebar, content}
				set lstSeldProj to (value of selected trees of oPanel where class of its value is project)
				set blnSeld to (lstSeldProj ≠ {})
				if blnSeld then exit repeat
			end repeat
		end tell
		
		-- EITHER MOVE ANY SELECTED PROJECTS,
		if blnSeld then
			repeat with oProj in lstSeldProj
				move oProj to before projects
			end repeat
		else
			-- OR REMIND USER OF NEED TO SELECT PROJECTS.
			display dialog "No projects selected ..." buttons {"OK"} default button "OK" with title pTitle & "  ver. " & pVer
			return
		end if
	end tell
end tell
--

Last edited by RobTrew; 2012-04-12 at 12:06 AM.. Reason: Slight code house-keeping - added comments & simplified