Activating particular terminal window

I have a number of terminal windows open and I want to activate one, i.e. bring it to the front so I can run a command in it. The title of I want to run the command in contains "Simple", at least that's what appears in the title bar of window.

I'm sure I am missing something but "Bring window to front" > "contains Simple" produces an error saying the window was not found.

How do I bring a particular terminal window to the front so I can run a command in it?

Thanks,
Dan

Hey Dan,

When asking such questions please post your macro, so we can attempt to discover where you went wrong.

See these two items if you haven't already:

Tip: How Do I Get The Best Answer in the Shortest Time?

How to Post Your Macro to the Forum

This works for me:

Bring Named Window Forward.kmmacros (4.9 KB)

-Chris

1 Like

This is a question about terminal windows. My macro is using "bring window to front/title containing" and looks l like this:

and the terminal window title bar is:

with "Simple 1" as the title.

But running this macro produces the error it could't "find window with title matching windows ..."

How do I find a particular terminal window by matching it's title?

TIA
Dan

Hey Dan,

My macro does exactly that...

So the question is why doesn't yours?

Change Front Application to Terminal.

Make sure you don't have a non-breaking-space or something instead of a <space> in the window title:

Download and install BBEdit if you don't already have it on your system.

Then get your Terminal window set up and frontmost.

Then run this script from the Applescript Editor:

tell application "Terminal"
   set fwName to name of front window
end tell
tell application "BBEdit"
   activate
   make new document with properties {text:fwName}
end tell

Once you have the name of Terminal's front window in BBEdit type I to display invisible characters.

See if you have any gray bullet characters or upside-down question mark characters.

-Chris