Any general way to tell when a scriptable app has finished its task?
Any general way to tell when a scriptable app has finished its task?
- Subject: Any general way to tell when a scriptable app has finished its task?
- From: "McLaughlin, Michael P." <email@hidden>
- Date: Fri, 20 Mar 2009 13:02:37 -0400
- Acceptlanguage: en-US
- Thread-topic: Any general way to tell when a scriptable app has finished its task?
This seems like a common question and I may have looked for it in the wrong
places. In any case, I have a long-standing issue regarding sending a
message, from AppleScript, to an app to do some work that might take a
while.
For many things, I use an idle handler strategy with status numbers in the
calling script, etc. But this does not solve the general problem.
Example:
I have a script that calls TextWrangler to do a few things, including Zap
Gremlins. When I first wrote this, as part of a much larger script, it
worked fine and I thought nothing of it.
Much later, I realized that, whenever someone sent me an unusually large
file, this step was far from instantaneous (as it normally is) and
AppleScript had gone on to execute more of itself without knowing that
needed input was not yet available.
Clearly, this is a common situation. My question:
Is there a *generic* method for determining that an app has finished
executing some task in this fashion or must one rely on functionality within
that app to provide the answer, trusting that the app will respond
serially?
So far, the only idea I have had is to send a Quit command to the app after
the "work" command and hope that the app does not treat the Quit as
pre-emptive. Obviously, this is a kludge and not robust.
Any thoughts?
TIA.
--
Mike McLaughlin
_______________________________________________
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