I'm trying to make (1) special key open new terminal window.

I bound it to file /Users/taw/bin/new_term, which contains:

#!/bin/sh
exec osascript -e 'tell application "Terminal" to do script "cd ."'

This does the trick, except it also opens a Terminal window with this (even though Terminal.app is configured to always close windows when processes finish):

Last login: Thu Mar 11 19:41:29 on ttys000
/Users/taw/bin/new_term ; exit;
~$ /Users/taw/bin/new_term ; exit;
tab 1
logout

[Process completed]

How do I make it all work correctly? (possibly using a way different that what I've been attempting so far)

link|improve this question

45% accept rate
feedback

2 Answers

Have your special key execute /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal instead.

(Out of curiosity, how are you binding a key to a command?)

Edit:

I try to keep anything Microsoft away from Mac OS, because they don't really seem to grok the Mac way. The fact that it's using open for everything is proof of this.

So, if I were you, I'd rip out the Microsoft keyboard driver, and use Spark instead:

http://www.brighthub.com/computing/mac-platform/reviews/30244.aspx

If you really want to use AppleScript to do what you're doing, perhaps this will be of use:

http://lambie.org/2007/11/03/tabs-in-terminal-using-applescript-on-leopard/

You could also snag some of the AppleScript from the latter link and trigger it with a hotkey using Spark.

link|improve this answer
Microsoft Keyboard drivers let me bind special keys (or any keys) to arbitrary file or URL. I think it tries to open the file using generic open command. Starting /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal seems to start a new process - not what I want. And then it opens the same window [Process completed] window. – taw Mar 11 '10 at 20:31
Spark doesn't see special keys on Microsoft Keyboard at all. – taw Mar 11 '10 at 22:58
So then don't use the special keys. Use command-control-0 or whatever you want. – Alexander Burke Mar 12 '10 at 7:51
feedback

Use one of the options to start a program or execute a script without opening Terminal I describe in this answer.


To open a new terminal window, or just Terminal with a default window, you can try to adapt this solution.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.