Great. Once again, thanks for going beyond the call of duty and help me with this.
The reason I was trying this approach (which, you are totally right, is not the best one) was because of the problem with the values not persisting. I thought doing things in this other way would circumvent that problem.
But you are right in your observations. I will follow your advice.
Well FWIW, this works (read after for the inevitable 'except):
use scripting additions
set myInput to "URL"
set myValue to "http://www.shoantel.com"
set myInput1 to "Tags"
set myValue1 to "small"
set myInput2 to "NeverComposite"
set myValue2 to "1"
activate application "Tinderbox 7"
tell application "System Events"
tell process "Tinderbox"
tell table 1 of scroll area 1 of group 1 of splitter group 1 of front window
set elemList to every row
repeat with elem in elemList
select elem
if exists checkbox 1 of UI element 2 of elem then
-- this is a checkbox row, so must be Boolean type
if name of static text 1 of UI element 1 of elem is equal to myInput2 then
if value of checkbox 1 of UI element 2 of elem is not equal to myValue2 then
click checkbox 1 of UI element 2 of elem
end if
end if
else
-- this must be any type except Boolean
-- now branch, based on attribute name: lists vs others
--all attribute types except Set, List & Boolean
if name of static text 1 of UI element 1 of elem is equal to myInput then
tell text field 1 of UI element 2 of elem
set focused to true
set value to myValue
perform action "AXConfirm"
end tell
end if
--Set and List types
if name of static text 1 of UI element 1 of elem is equal to myInput1 then
tell text field 1 of UI element 2 of elem
set focused to true
set oldList to value as text
set value to (oldList & ";" & myValue1)
perform action "AXConfirm"
end tell
end if
end if
end repeat
end tell
end tell
end tell
OK, all is well except if the input value (i.e. new attribute value) triggers the autocomplete pop-up menu. This causes the process to hang. If you wait c.5 seconds the pop-up self-dismisses and everything completes. But I guess you now have to test if the auto-complete list has opened, then address that element (not the text box) and so on. I don’t think that’s worth the time to figure out (the auto-complete list doesn’t show in my UI inspection tools).
So, no full solution then, but I’ll leave the code above in case it is of use to everyone. If nothing else it dusted off my rusty AppleScript knowledge and reacquainted me with a few tools I’ve not used in a while