View Single Post
In truly churlish fashion, I'll point out that you won't get the results you want if you are toggling a group of contexts which are not all in the same availability state :-)

If you had two sets of contexts which were mutually exclusive (set A is available when set B is unavailable, and vice versa), Rob's improved version would set them all to be available or unavailable. Here's an improvement on the improvement:

-- Toggle selected contexts
tell application id "OFOC"
	tell front document window of front document
		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
		repeat with curContext in refContexts
			set blnOnHold to not allows next action of value of curContext
			set allows next action of value of curContext to blnOnHold			
		end repeat
	end tell
end tell