Re: Waiting for Godot
Re: Waiting for Godot
- Subject: Re: Waiting for Godot
- From: Matthew Smith <email@hidden>
- Date: Wed, 12 Dec 2001 16:20:44 +1100
on 12/12/2001 15:29, Ricardo J. Seijo at email@hidden wrote:
>
I apologize if this is a FAQ, but the archives don't seem very
>
searchable. How do I tell a script to sit tight and wait until a specific
>
application has been closed before resuming its actions? I want it to make
>
a set of changes and launch an application, then wait until the user closes
>
said application to reverse the original changes. Thanks in advance!
You need to set the script applet so it stays open. You then create an idle
handler which will check to see if the application in question is still
running. When it is not it will then do your work.
on run
-- do initial stuff
launch myApp
end run
on idle
tell app "Finder"
set procList to every application process
set appFound to false
repeat with x in procList
if name of x = "my apps's name" then set appFound to true
end repeat
end tell
if appFound then
-- do post stuff
tell me to quit
end if
return 60 -- don't do anything for 60 seconds
end idle
on quit
continue quit
end quit
--
Matthew Smith