make applescript close keynote after presentation is over

does anyone know how i would achieve the following?

i want to make applescript close Keynote AFTER the slideshow is finished. any idea?
mybe via the class “playing” in keynotes application properties?
but i dont know hw to write it.

my code so far

tell application "Keynote" to open "/Users/bla/Desktop/bla1.key"
delay 3
set var to properties of application "Keynote"
repeat
if var contains "playing:false" then
exit repeat
end if
delay 1
end repeat

do shell script "killall 'Keynote'"

:expressionless:
thx:)

Hi artofseeing. Welcome to MacScripter.

I have Keynote as part of iWork, but have never used it. But someone sent me a slideshow today, so I’ve been able to experiment. This does what your pseudocode seems to be suggesting:


tell application "Keynote"
	activate
	open POSIX file "/Users/bla/Desktop/bla1.key"
	tell slideshow 1
		repeat until (it exists)
			delay 0.5
		end repeat
		repeat until (playing)
			delay 0.5
		end repeat
		repeat while (playing)
			delay 0.5
		end repeat
	end tell
	quit
end tell