Dec 03, '03 10:05:00AM • Contributed by: diamondsw
click checkbox "Show Icon Preview" of window "Show View Options"
To work around this, use the UIElementInspector to "lock on" (Command-F7 while hovering) to the item you want to script. For any locked item in the UI Element Inspector, you can refer to its children by their position on the "goto->AXChildren" popup menu in the "Locked on" inspector window. So if a given UI item has three children (say AXUnknown, AXCheckBox, AXSomethingOrOther), then you can refer to AXUnknown using UI Element 1 of item. This can be used to script user interface elements that are children of AXUnknowns, which are otherwise unscriptable.
For example, say you want to script the "Show Icon Preview" checkbox in "View Options". According to the UI Element Inspector, it is [check box whose title is "Show icon preview" of AXUnknown of AXUnknown of window "View Options"]. However, these AXUnknown's aren't scriptable in this manner, so you need their raw UI Element ID's. To find these, navigate to the parent and look at its list of children. If there are multiple AXUnknown's you may have to dig through their children to determine which is the AXUnknown you're looking for. After doing this, you can determine that UI element 3 and UI element 1 are the first and second "AXUnknown" items above the "Show Icon Preview" checkbox, so you can script it as follows:
tell UI element 3 of window 1
click radio button "This window only"
of radio group 1 of UI element 2
set uiSIP to checkbox "Show Icon Preview" of UI element 1
if the value of uiSIP is 0.0 then click uiSIP
end tell
Thanks to Randall Million of Plaid Cow Solutions for the original script that led me to discovering this (and using it all over the place!).
