Make applescript close keynote after presentation is over

applescriptkeynote

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'" 

thx

Best Answer

If you run this to kick off the keynote then it will quit Keynote as soon ( well within 5 seconds ) as you stop presenting (esc). If you want it to quit after you sit on the final slide for a preset amount of time then just say so.

tell application "Keynote"
    if not playing then
        start
        repeat while playing
            delay 5
        end repeat
    end if
    quit
end tell