Can't quit application (can't get window x of process y)

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.

--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.

set position of Finder window 1 to {318, 178}

Change the bold to your application ofcource :slight_smile:

And Your coordinates.

I’m not sure I understand. Can you elaborate a bit?

set position of iShowU window 1 to {318, 178}

That’ll set the Window to move to those X,y places
Or do you mean you want to know what the current coordinates are?

Thanks. Just wondering where that line would go and why setting the coordinates of the iShowU window helps to make sure that I can close it.

Oh you want the script to close an application?In that case,

quit application "iShowU"