Re: Starting process and bringing to the front
Re: Starting process and bringing to the front
- Subject: Re: Starting process and bringing to the front
- From: Richard 23 <email@hidden>
- Date: Tue, 31 Oct 2000 01:07:46 -0800
>
tell application "QuickTime Player"
>
launch
>
open file "Misc:Movies:world.mov"
>
set looping of movie "world.mov" to true
>
present movie "world.mov" scale current
>
quit
>
end tell
>
>
It does almost all I want: starts the player, opens the movie, and presents
>
it. However, the movie plays *behind* other windows, not in front.
>
>
Has anyone any idea how I might be able to force it to the front?
>
>
Thanks,
>
>
Martin Shields.
Martin:
I'll address your last question first:
>
Does anyone know of some way of interrupting the Present Movie option via
>
AppleScript so that the QuickTime Player can receive the Quit? Is there some
>
way to pass an "Escape" keypress to the app?
I only know of escape or cmd-period, but those are standard on mac
applications
so shouldn't be too objectionable...
Here's my take on your script:
-- --------------------------------------------------
-- put it all together, lauch, bring to front, play
-- --------------------------------------------------
on run
LaunchPlayer()
set moovFolder to "Misc:Movies:"
set moovName to "world.mov"
PlayMoov(moovFolder, moovName)
end run
-- --------------------------------------------------
-- launch QuickTime Player and bring it to the front
-- --------------------------------------------------
on LaunchPlayer()
launch application "QuickTime Player"
tell application "Finder"
set theProcess to a reference to process "QuickTime Player"
repeat until exists theProcess
end repeat
set frontmost of theProcess to true
end tell
end LaunchPlayer
-- --------------------------------------------------
-- Play the selected movie front and center
-- --------------------------------------------------
on PlayMoov(moovFolder, moovName)
set moovPath to moovFolder & moovName
tell application "QuickTime Player"
open file moovPath
set looping of movie moovName to true
present movie moovName scale current
quit
end tell
end PlayMoov
Hope this is helpful.
R23