View Single Post
And to cycle a whole clump of selected contexts between three states:

Code:
-- Toggle selected contexts
tell application id "OFOC"
	tell front document window of front document
		-- GET A REFERENCE TO THE SELECTED CONTEXTS
		repeat with oPanel in {sidebar, content}
			set refContexts to (a reference to (selected trees of oPanel where class of its value is context))
			set lngContexts to count of refContexts
			if lngContexts > 0 then exit repeat
		end repeat
		if lngContexts < 1 then return
		
		-- GET THE STATE OF THE FIRST SELECTED CONTEXT
		tell (value of first item of refContexts) to 
			set {blnNotOnHold, blnHidden} to {allows next action, effectively hidden}
		
		-- CYCLE THE STATE AROUND A TRIANGLE
		-- Active --> on hold --> dropped --> active
		if blnNotOnHold then
			set {blnNotOnHold, blnHidden} to {false, false}
		else if blnHidden then
			set {blnNotOnHold, blnHidden} to {true, false}
		else -- on hold
			set {blnNotOnHold, blnHidden} to {false, true}
		end if
		tell value of refContexts to 
			set {allows next action, hidden} to {blnNotOnHold, blnHidden}
	end tell
end tell
--

Last edited by RobTrew; 2011-08-25 at 03:09 PM..