• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Batch Program Processing via AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Batch Program Processing via AppleScript


  • Subject: Re: Batch Program Processing via AppleScript
  • From: Benoit Blaquiere <email@hidden>
  • Date: Tue, 04 Dec 2001 13:23:17 +0100

> I am a newbie to AppleScript, so this problem may be already solved.
> However, I wasn't able to find anything in the archives.
>
> I have a large number of Absoft Macintosh FORTRAN programs (call them A,
> B, C, D, etc) that must be executed sequentially. The problem is: B must
> only start executing after A is completely done, C must only start
> executing after B is completely done, etc. How can this batch program
> processing be done using AppleScript? (This is analogous to a simple
> DOS BAT file.). When I tried, Programs A, B, C, D, etc, all began
> running at the same time, instead of waiting appropriately.
>

Follows a handler that I used in the past in one of my scripts.

You use it like this :

tell application "Finder" to open "A"
my WaitProcessEnd ("A",1,6,1)

tell application "Finder" to open "B"
my WaitProcessEnd ("B",1,6,1)

...


on WaitProcessEnd(appName, waitProcessLoopDelay, waitProcessLoopMax,
waitProcessEndLoopDelay)
-- Uses a timeout because of non-cooperative applications.
with timeout of 3600 seconds
-- Waits until the application is in the processes list
-- every waitProcessLoopDelay seconds.
-- Gives up after waitProcessLoopMax loops if the application is not
-- in the processes list : some small quick applications don't appear
-- in the processes list.
repeat waitProcessLoopMax times
tell application "Finder" to set processList to name of every process
if processList contains appName then exit repeat
delay waitProcessLoopDelay
end repeat
-- Waits until the application is not in the processes list.
-- Verifies every waitProcessEndLoopDelay seconds.
repeat
tell application "Finder" to set processList to name of every process
if processList does not contain appName then exit repeat
delay waitProcessEndLoopDelay
end repeat
end timeout
end WaitProcessEnd


HTH
Benoit

--
Benoit BLAQUIERE e-mail: email@hidden
Institut Geographique National / IGN Espace
Parc Technologique du Canal - 24, rue Hermes
31527 Ramonville-Saint-Agne cedex - France
Tel: +33 (0)5 62 19 19 45 Fax: +33 (0)5 61 75 03 17


References: 
 >Batch Program Processing via AppleScript (From: "Dennis F. Kahlbaum" <email@hidden>)

  • Prev by Date: Re: <<event FNDRsope>> (WAS Re: Path to app ...)
  • Next by Date: Re: Tell default browser to open a URL
  • Previous by thread: Batch Program Processing via AppleScript
  • Next by thread: Re: Batch Program Processing via AppleScript
  • Index(es):
    • Date
    • Thread