Check in QuickTime Player is paused, if it is play ?

I would like a script that on idle checks if QuickTime Player is currently playing a movie, and if it isn’t then make it do so. How do I ask QuickTime Player its status, if it is playing or if it is paused? I guess the script needs to also check if QuickTime Player is even running.

So is QuickTime Player running? If not open a specified movie and play it full-screen and with looping.
Is QuickTime Player open but the movie is paused? If so play the movie.
Is QuickTime Player open and playing? Do nothing.

Thank you.

Maybe I figured it out. I found a property in QuickTime Player called playing, so I cobbled this together and so far it seems to work…

set movieFile to POSIX file "/path/to/some/movie.mov"

tell application "QuickTime Player"
	try
		set isPlaying to get playing of document 1
	on error
		open movieFile
	end try
	if isPlaying is true then
	else
		set the looping of document 1 to true
		play document 1
	end if
end tell

I’ve changed my script to present the playing movie full screen, is there a way to find out of the movie is playing, but not full-screen so I can switch it to full screen?

there’s a property presentation size


tell application "QuickTime Player"
	set isFullScreen to presentation size of document 1 is screen
end tell

Thank you StefanK,

I find that if my movie is Full Screen and paused I don’t get into the part of my script that should play the movie.

Any advice?


on idle
	set movieFile to POSIX file "/Users/user/Desktop/looper.mov"
	
	tell application "QuickTime Player"
		activate
		set isPlaying to false
		try
			set isPlaying to get playing of document 1
		on error
			open movieFile
		end try
		if isPlaying is true then
			set isFullScreen to presentation size of document 1 is screen
			if isFullScreen is true then
			else
				set the looping of document 1 to true
				present document 1
			end if
		else
			set the looping of document 1 to true
			present document 1
		end if
	end tell
end idle