I am scraping data from the web and my scripts get longer because of repetitions. So I want to replace some commands with a string .
The script below hopefully shows what I mean in the try block the 1st command works the second which concatenates the 1st half with the string “LastSt” does not. Have tried passing it as string & text also as a system attribute. I assume it needs to pass as a parameter but can not figure that out nor could I find anything in the dictionary.
[AppleScript]
tell application “System Events”
tell process “Safari”
set Br to 75
set LastSt to “of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1”
repeat 30 times
try
click button 1 of group Br of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
--click button 1 of group Br & LastSt
exit repeat
end try
set Br to Br + 1
end repeat
end tell
end tell
[/AppleScript]
Thanks for looking
Peter