While it's great that UI Scripting has been integrated into Panther, it has some potholes compared to its earlier Jaguar incarnation. Specifically, many of the user interface items you'd like to script (for instance, the "Show Icon Preview" checkbox in view options) are children of "AXUnknown". This effectively prevents you from using:
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.
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!).
Mac OS X Hints
http://hints.macworld.com/article.php?story=20031119193951881