Do you guys know if there is a way to change the window/ program focus after closing a quicktime movie. I use a fullscreen flash app to launch a quicktime movie. When the movie is done playing I want to return to fullscreen mode in flash. I know how to close my movie but I can’t figure out how to get window focus back on my flash player again.
Here is what I’ve done:
tell application “QuickTime Player”
activate
open file “…alpha.mov”
set the movie_name to the name of movie 1
present movie scale screen
set close when done of movie 1 to 1
end tell
Find the name of the flash process (not having flash, I don’t know what that would be, use Activity Monitor to see), set it to frontmost using System Events.
tell app "System Events"
set frontmost of process "flash process name" to true
end tell
Thanks!
But how do I start this after the movie is played?
I want to keep quicktime focused during playback and
afterwards go back to flash player again.
tell application "QuickTime Player"
activate
open (choose file) --"...alpha.mov"
tell movie 1
present scale screen
repeat while ((playing is true) or (current time < duration))
end repeat
close
end tell
end tell
try
tell application "System Events"
set frontmost of process "flash process name" to true
end tell
on error
display dialog "Please Press Apple+Tab or bring the flash player to the front by other means" giving up after 12
end try
to allow multiple windows, modify the beginning of the tell movie 1 block to:
set myMovie to movie 1
tell myMovie
also to make sure the user didn’t pause the movie, the repeat loop includes a check on the position and length of the movie
What you might like to consider catching is wether the user closed the movie or actually quits QT. Expect some errors there or put it in a try block to catch them.