Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how can i know from the java code that an applescript completed to run? - urgent



Itia Gerbi wrote:

> I'm using:
>
> Process p = Runtime.getRuntime().exec(i_cmdLine);
>
> retVal = p.waitFor();
>
> the waitFor() returns after the script was started to run,
>
> but it doesn't wait for the for the script to be completed.
>
> I need some indication to know when the apple script completed its work.
>(in my case the script is generating some files, so I need to know when
>the files where generated)

There's no way I know of to get what you want without some kind of
cooperation from the script that's running asynchronously.

The problem isn't unique to exec(), nor to scripts.  The problem is
fundamental to any kind of asynchronous operation.  If the async action
can't provide SOME kind of signifier, either as an intentional signifier or
as a side-effect, then it's simply impossible to accurately determine when
it's done.

An intentional signifier would be a file or an event that the script itself
creates or sends when it's done.

Side-effects would include things like looking for the appearance of a
file, looking for the termination of a descendant process, looking for the
absence of a process with a particular name, waiting a maximum elapsed
time, and other hacks.  These are all hacks, and unreliable.

Under normal scripting conditions, how would a scripter who's using the
script find out when it's finished?  To answer that, you need to refer to
the docs of the async script, or look at its source code.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.