Can't use click button from System Events

I’m getting the following error:

System events got an error: Can’t get window "iShowU’ of process “iShowU”

when I run this code. It errors on the line where I’m trying to press the finish button towards the end. I can’t use quit because it exits without saving the recorded video.

--start recording
activate application "iShowU"
delay 1
tell application "System Events"
   tell process "iShowU"
       click button "Record" of window "iShowU"
       delay 5
   end tell
end tell

--start the video
activate application "Firefox"
tell application "System Events"
   tell application process "firefox-bin"
       set frontmost to true
       set value of attribute "AXMain" of (first window whose name contains "CSCI") to true
       delay 1
       tell application "Terminal"
           do shell script "/Applications/click click -x 85 -y 346"
       end tell
       delay 2
       
   end tell
end tell

activate application "iShowU"
tell application "System Events"
   tell process "iShowU"
       click button "Finish" of window "iShowU"
   end tell
end tell

Any help would be appreciated. It’s the last hangup I’m having.

Sorry about the repost. It got off on a tangent last time and the thread seemed to have gotten confused.

Hi

Just downloaded the app and tried your script, worked fine only after commenting out the below code.

–tell application “Terminal”
–do shell script “/Applications/click click -x 85 -y 346”
–end tell

hpoe this might help

Budgie

Thanks. Maybe it’s an applescript bug of some kind.

Jody

Actually, I think I’m going to scrap this and try a whole new approach with Safari instead. Safari seems to be much more friendly in terms of picking up the UI elements with inspector. Now I’ve run into another problem with it, but it may be easier to solve. I’ll start a new thread when I’m ready since it’s quite different.

Thanks.