Re: is application busy
Re: is application busy
- Subject: Re: is application busy
- From: Christopher Nebel <email@hidden>
- Date: Wed, 10 Jan 2007 11:35:05 -0800
On Jan 10, 2007, at 11:16 AM, Emmanuel wrote:
At 4:54 PM -0500 1/9/07, Bob Cuilla wrote:
I am scripting iphoto and would like to know when it is done saving
its contents to the library
I know on can do this sort of thing
tell app "System events"
if(process "iphoto") exists
-- more stuff here
end tell
to tell if an app is running.
can you also use "system events" to see if an app is busy ( or
still busy) saving to disk?
There is no such thing as asking an app whether it's busy saving to
disk. What I would do is: check whether iPhoto is responsive or not
while it's saving. If it's not you can perform repetitively a line
such as:
try
with timeout of 1 seconds
tell app "iPhoto" to get 1+1
end timeout
-- iPhoto is responsive
on error
-- iPhoto is not responsive, maybe busy?
end
That particular script won't do what you want, since "1+1" is always
handled by the interpreter, but the basic technique is sound. Try
asking it for an application property ("current album" would work) or
something like the name of window 1 instead.
At least in theory, a command sent to iPhoto will be handled once
iPhoto is done with whatever it's busy with. If it winds up being
busy (i.e., unresponsive) for long enough, then the command will time
out -- the default is one minute. However, this is arguably a bug --
an application should (ideally) never be unresponsive to events for
that long.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden