View Single Post
Perhaps there is a way to do this through the GUI ?

In any case, here is a simple script.

After Edit > Select > Similar Objects, you could use it to alternate between selecting shapes and selecting lines.

Or, if you begin by selecting a particular sub-tree of your diagram, you could use the script to alternate between selecting that and selecting all the other graphics on the visible and unlocked layers of your canvas.

I find this useful for pulling a part of a diagram into the foreground, and pushing the rest of it into the background (by slightly graying it, for example).

-- VER 0.2

-- Changes
-- Ver 0.2		If used when nothing is selected, should remember selection resulting from last use of this script.
--				NB selection memory only works when script is launched in environments in which properties persist
--				(e.g. will work if launched from a script menu, by not if launched from LaunchBar

property plstSeln : {}
property plstInvert : {}

on run
	tell application id "OGfl"
		tell front window
			set plstSeln to selection
			if plstSeln ≠ {} then
				repeat with i from 1 to length of plstSeln
					set item i of plstSeln to id of item i of plstSeln
				end repeat
				my InvertGraphicList(its canvas, plstSeln)
				set selection to plstInvert
				if plstInvert ≠ {} then set selection to plstInvert
			end if
		end tell
	end tell
end run

on InvertGraphicList(oCanvas)
	set plstInvert to {}
	tell application id "OGfl"
		set refLayers to a reference to (layers of oCanvas where its visible is true and its locked is false)
		set lstAllID to my FlatList(id of graphics of refLayers)
		repeat with i from 1 to length of lstAllID
			set lngID to item i of lstAllID
			if lngID is not in plstSeln then set end of plstInvert to graphic id lngID of oCanvas
		end repeat
	end tell
end InvertGraphicList

on FlatList(lst)
	if class of lst is not list then
		return {lst}
	else if lst = {} then
		return lst
		return FlatList(item 1 of lst) & FlatList(rest of lst)
	end if
end FlatList

Last edited by RobTrew; 2011-11-06 at 07:51 AM.. Reason: Ver .02 if used when nothing is selected, remembers previous selectio