• 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: Tabs in Terminal.app on Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tabs in Terminal.app on Leopard


  • Subject: Re: Tabs in Terminal.app on Leopard
  • From: "Matthew Lambie" <email@hidden>
  • Date: Fri, 2 Nov 2007 11:42:34 +0900

On Nov 2, 2007 1:10 AM, Philip Aker <email@hidden> wrote:
>
> set scpt to "ls -laFG"
>
> I've found that 'do script scpt in window 1' works whether or not
> Terminal is already running.

That's kinda what I'm chasing, but I want to open multiple tabs and
run multiple applications, which I can't seem to work out.

> In Terminal's dictionary (Shift-Command-O in Script Editor) it looks
> like one can use "custom title" for tabs.

I thought the title would be the text that's displayed on the tab,
which is at the moment the name of the process. The window title is
"user@machine: /path - app" -- could I use that as a reference to the
window that I'm wanting to target perhaps?

Thanks for your help Philip,

>
> Philip Aker
> echo email@hidden@nl | tr a-z@. p-za-o.@
>
>
> On 2007-31-10, at 21:42, Matthew Lambie wrote:
>
> > Hi everyone,
> >
> > I thought rather than mix in Apple Script and pseudocode together I'd
> > just post my pseudocode - I hope that's OK. Via Google I've learnt how
> > to tell Terminal to run a script, so it's more the case of opening new
> > tabs and checking for focus.
> >
> > I have two main issues:
> > - Can you "name" windows via Applescript?
> > - How do you launch a new tab within Terminal?
> >
> > For example, I've found this script which will open a Terminal (or use
> > the first available non-busy Terminal), obtain focus and execute a
> > command (uptime):
> >
> > property commandString : "/usr/bin/uptime" -- < Edit this line as
> > desired.
> >
> > tell application "Terminal" -- Get a free window to run the
> > commandString,
> >       activate -- (being sure to avoid creating a new session
> > unnecessarily,
> >       -- while also handling the possibility that frontmost window is
> > busy):
> >       set windowCount to (count of the windows)
> >       if windowCount is greater than 0 then
> >               repeat with w from 1 to windowCount
> >                       if window 1 is busy then
> >                               set frontmost of window 1 to false
> >                       else
> >                               do script commandString in window 1
> >                               set frontmost of window 1 to true
> >                               return
> >                       end if
> >               end repeat
> >       end if
> >       tell window 1
> >               do script commandString
> >               set frontmost to true
> >       end tell
> > end tell
> >
> > (script via : http://forums.macosxhints.com/showthread.php?p=359524)
> >
> > I want to perform the following (pseudocode) with Terminal - can
> > anyone help me out?:
> >
> > server_name = "SERVER_NAME"
> > Open Terminal
> > if a window called server_name exists
> >     give it focus
> > else
> >     create a new window
> >     name this window server_name
> >     for i = 1 to 4
> >         create a new tab
> >         execute a command (ssh server_name)
> >     end for
> > end
> >
> > The idea is that I'll click an icon and it opens Terminal up, opens 4
> > tabs and in each tab performs an ssh to SERVER_NAME (and opens a
> > screen session). Ideally, I'd like to test if the window already
> > exists and if it does, give it focus. This will prevent the screen
> > sessions from being "dropped" in the original window and opening again
> > in the new window, if it exists.
> >
> > I'd also like to attach the scripts to individual icons, so I can
> > click on hotrod, prime, soundwave or any other cool Transformers icon
> > that I have in my dock to represent our servers.
> >
> > Thanks so much - I'm loving Leopard and Terminal's tabs... I just
> > want some automation!
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Tabs in Terminal.app on Leopard
      • From: Philip Aker <email@hidden>
References: 
 >Re: Tabs in Terminal.app on Leopard (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: [Slightly OT] Scripting Bridge in Leopard
  • Next by Date: Re: [Slightly OT] Scripting Bridge in Leopard
  • Previous by thread: Re: Tabs in Terminal.app on Leopard
  • Next by thread: Re: Tabs in Terminal.app on Leopard
  • Index(es):
    • Date
    • Thread