• 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
Send script to a certain Terminal window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Send script to a certain Terminal window


  • Subject: Send script to a certain Terminal window
  • From: Gnarlodious <email@hidden>
  • Date: Thu, 03 Feb 2005 11:18:33 -0700

I'm trying to send commands repeatedly to a certain open Terminal window.
If the window already exists, I write to that window, if it doesn't, I
create the window and remember the filespec for future use.

It works as expected on firstrun, but subsequent runs sends this error:

Can't make window id 7103 of application "Terminal" into a vector.

What's causing this error? How do I tell Terminal to run a script in this
filespec?


set cmd to "date"
set instanceName to "Applescript result"

property windowName : "" -- to instanceName & " ‹ bash"

tell application "Terminal"
    activate

    if windowName is not in windows then
        -- make the window
        do script "echo " & instanceName
        tell front window to set custom title to instanceName
        set windowName to item 1 of windows
    end if

    do script cmd in windowName
end tell

--
Cosmetic Justice; when the Botox gives you Mad Cow Disease
                                            -- Gnarlodious


 _______________________________________________
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

  • Follow-Ups:
    • Re: Send script to a certain Terminal window
      • From: jj <email@hidden>
  • Prev by Date: Re: scripting data into sheets
  • Next by Date: Re: Send script to a certain Terminal window
  • Previous by thread: Re: scripting data into sheets
  • Next by thread: Re: Send script to a certain Terminal window
  • Index(es):
    • Date
    • Thread