• 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: Simple Repeat until loop problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple Repeat until loop problem


  • Subject: Re: Simple Repeat until loop problem
  • From: "Nigel Garvey" <email@hidden>
  • Date: Fri, 23 Dec 2005 00:08:03 +0000

I wrote Thu, 22 Dec 2005 20:48:14 +0000:

>The problem's the window numbering system. When a new window opens, it
>becomes the new window 1 and the others all move back one. Your script's
>actually checking the 'busy' of the rearmost window. If you simply check
>the 'busy' of window 1, you should be OK -- although inserting a short
>delay just before the repeat would allow the Terminal a little extra time
>to create the window for the 'do script' command and set its 'busy' status.
>
>Another idea, if it suits your purposes, is to run the script in the
>existing front window, which would save another from opening:

To open Terminal on my slower machine, call 'do script', and wait for the
process to finish, this seems to be required:

  tell application "Terminal"
    activate

    -- Wait (if necessary) until "login" & "tsch" are going.
    repeat until ((count front window's processes) is 2)
    end repeat

    -- Order the 'do script'.
    set shellScript to "Your stuff here" -- Adjust as necessary.
    do script shellScript in front window

    -- Wait until the command appears in the window.
    repeat until (front window's contents contains shellScript)
    end repeat

    -- Wait until the process has finished.
    repeat while (front window is busy)
    end repeat

    display dialog "Process finished"
  end tell

The 'do shell script' command, without the Terminal, is obviously a
handier option if it suits the particular purpose.

NG

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Simple Repeat until loop problem (From: "Nigel Garvey" <email@hidden>)

  • Prev by Date: RE: Finding lines containing foo in a file
  • Next by Date: Name of Volume inside a disk image
  • Previous by thread: Re: Simple Repeat until loop problem
  • Next by thread: Name of Volume inside a disk image
  • Index(es):
    • Date
    • Thread