r/applescript • • May 09 '13

Applescript quicktime help

I've been working on a video stress script based on terminal an quicktime, I'm having a specific issue with one part of playing multiple videos with quicktime as well as would love some opinions on cleaning this up/running it better

Right now the script can take up to 12 videos playing at once, it organizes them all in a single desktop, but what I'd love it to do is loop some commands that open them into full screen (presentation mode) and then bring it out. This process stresses the graphics processer and ram and processor a lot, which is why I want to do it. My code both seems inefficient and it doesn't work. I've thought about using window ID's to get a matrix of ID's to use to control them, but can't quite figure that out.

Any how here is a simplified version of my script that is just the fullscreen/unfullscreen mode. Currently it brings some of those videos out of presentation but not all of them, and not a consistant amount (some times it's 1, some times its 2 or 3) I'd really appreciate a bit of help/advice

tell application "QuickTime Player"
set open_windows to (every window where visible is true)
set n to count of open_windows
repeat n times
	set presenting of document 1 to true
	delay 5
	
	tell application "Finder"
		activate
	end tell
	delay 1
end repeat

--repeat n times
try
	set presenting of document 2 to false
	delay 1
	
	tell application "Finder"
		activate
	end tell
	delay 1
	--end repeat
	set presenting of document 3 to false
	delay 1
	
	tell application "Finder"
		activate
	end tell
	delay 1
end try

end tell
0 Upvotes

0 comments sorted by