While terms like ‘parent’ and ‘children’ are used to describe general relationships between UI elements, Andy, they aren’t actually relevant keywords in this context. The term ‘length’, used as a property in certain situations, is not really relevant to GUI scripting, either. (In other words, you won’t find the terms in the Processes Suite of System Events’ AppleScript dictionary.)
The situation you’ve outlined could easily be one in which you’re trying to script a browser like Safari. Even if that’s not the case, I’ll use Safari as an example, anyway - just to provide a convenient ‘tell’ wrapper. (Hopefully, you’re right about the ‘path’ so far to the area that interests you.)
One way to get the children of a UI element is to use attribute “AXChildren”:
tell application "System Events" to tell process "Safari"
value of attribute "AXChildren" of UI element 1 of scroll area 1 of group 4 of window 1
end tell
However, this is usually pretty much the same as saying:
tell application "System Events" to tell process "Safari"
UI elements of UI element 1 of scroll area 1 of group 4 of window 1
end tell
To count objects, use the the count command:
tell application "System Events" to tell process "Safari"
count UI elements of UI element 1 of scroll area 1 of group 4 of window 1
end tell
As Eelco says, double-clicking can be problematic - although there are sometimes ways around the obstacles. It’s hard to generalise with this stuff - since each situation can differ slightly.
Let’s say we wanted to open an item on the desktop. (There are obviously better ways than using GUI scripting for this, but this is just to demonstrate the point.) To do this manually, we’d normally just double-click the icon - but we can’t do that effectively using GUI scripting. However, Finder items have an action that could prove useful here: “AXOpen”:
tell application "System Events" to tell group 1 of scroll area 1 of process "Finder"
set l to name of UI elements
tell me to tell (choose from list l)
if it is false then error number -128
set i to item 1
end tell
perform action "AXOpen" of UI element i
end tell
For more specific help on this, though, I’m afraid you’ll need to give us a bit more information…
And if all else fails, it might also be worth checking out Extra Suites, which has a ‘double click’ parameter for its ‘ES click mouse’ command.