AppleScript Help: Select all children

Gavin Kistner gavin at refinery.com
Sat Apr 26 21:30:02 PDT 2003


On Saturday, April 26, 2003, at 09:29 PM, Gavin Kistner wrote:
> 3) Using AS, how do I get at the individual items in the selection?

With the help of some kindly people on IRC, we finally found the 
solution to this question. The answer is to use 'as list' with the 
selection so you can get at the items. (Perhaps there's a conflict with 
the class and plural being named the same? My AS is so shaky :)

Still no glory on getting OmniGraffle to select an item by adding it to 
the selection list, however. The following gives the 
ever-so-enlightening response from OmniGraffle of 
"NSInternalScriptError"

tell application "OmniGraffle Professional"
	set start to (item 1 of (selection of the front window as list))
	if (count of outgoing lines of start) > 0 then
		set childToAdd to destination of item 1 of outgoing lines of start
		set selection of front window to (selection of front window as list) 
& {childToAdd}
		--childToAdd has been verified as present and the correct item.
	end if
end tell


> 4) How would I get the text contents of a single selected non-grouped 
> object? (My JS tests on properties of a single object object inside 
> the 'selection' array seems to indicate that it is not of class 
> 'solid'...but that's the only class I see with a .text property other 
> than label.)

To answer myself again: although I can't find the JS version that 
works, the applescript above returns a reference to a shape object, and 
as that inherits from solid the text property works just fine, in AS.




More information about the OmniGraffle-Users mailing list