I am writing GUI scripts for a flashcard application called Anki. My goal is to change a field in a browser.
The current value is the field is 'foo. I want to set it to ‘bar’.
tell application "System Events"
tell application process "Anki"
tell window 1
tell splitter group 1
tell group 1
tell table 1
tell row 8
tell static text 1
tell group 1
tell static text 1
set v to value
set value to "bar"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
The command ‘set v to value’ returns ‘foo’, suggesting that the object is properly referenced.
However the command ‘set value to “bar”’ does not do anything. The is no error message either, nothing happens.
To help me with GUI scripting, I use an application called ‘UI Browser’ by PFiddlesoft.
It does tell me that the value of ‘static text 1’ is a modifiable text string.
Of course, I can also edit the field by hand with no issues.
I tried to rewrite the script as one line (set value of … of … etc).
I also tried inserting around at various points ‘activate’, ‘click’ and ‘delay’. Nothing helped.
Any help to put me on the right direction would be greatly appreciated!
Thanks in advance. W.