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

Re: Send script to a certain Terminal window


  • Subject: Re: Send script to a certain Terminal window
  • From: jj <email@hidden>
  • Date: Thu, 03 Feb 2005 19:45:20 +0100

This works here:

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

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

tell application "Terminal"
    try
        do script cmd in w
    on error
        do script "echo " & instanceName
        tell front window to set custom title to instanceName
        set w to item 1 of windows
    end try
end tell
#########################################



jj


> 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

--
http://www.macscripter.net/
http://www.osaxen.com/


 _______________________________________________
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: Gnarlodious <email@hidden>
References: 
 >Send script to a certain Terminal window (From: Gnarlodious <email@hidden>)

  • Prev by Date: Send script to a certain Terminal window
  • Next by Date: Re: Finder's insertion location
  • Previous by thread: Send script to a certain Terminal window
  • Next by thread: Re: Send script to a certain Terminal window
  • Index(es):
    • Date
    • Thread