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 > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Script: Invert / toggle OmniGraffle selections Thread Tools Search this Thread Display Modes
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).

Code:
-- INVERT SELECTION
-- 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
			else
				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
	else
		return FlatList(item 1 of lst) & FlatList(rest of lst)
	end if
end FlatList

Last edited by RobTrew; 2011-11-06 at 06:51 AM.. Reason: Ver .02 if used when nothing is selected, remembers previous selectio
 
If run when nothing is selected, ver 0.2 will try to remember the previous selection.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for script to toggle parallel/sequential vinyl_warrior OmniFocus Extras 5 2011-04-07 06:19 AM
Script to toggle expansion of notes RobTrew OmniOutliner 3 for Mac 0 2010-08-16 09:14 PM
Selections and Styles omnifan OmniGraffle General 2 2010-01-09 01:35 PM
Script to toggle display of bullets RobTrew OmniOutliner 3 for Mac 0 2009-07-17 12:40 AM


All times are GMT -8. The time now is 03:01 AM.


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