Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Script launches multiple Terminals w/ incorrect path' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Script launches multiple Terminals w/ incorrect path
Authored by: vaag on Oct 31, '01 05:31:57AM

I'm having the same problem. Actually, the terminal is showing the parents path.
The terminal window title is: cd '/Users/username/foldername/'; clear
with foldername being the parent directory of the one I selected.



[ Reply to This | # ]
Script launches multiple Terminals w/ incorrect path
Authored by: liyanage on Oct 31, '01 05:56:13AM

Is there something special about the folder you were in?
Is it an alias or symbolic link?
Any funny characters?

I need to be able to reproduce this so I can fix it.



[ Reply to This | # ]
Script launches multiple Terminals w/ incorrect path
Authored by: vaag on Oct 31, '01 08:06:39AM

No, no special characters, no alias, none of them.
For instance, if I open or select my home directory, [localhost:/Users/vaag], after launching
the script the terminal window title will be: cd '/Users'; clear
And I'm actually in the Users directory. The same result with every other folder.



[ Reply to This | # ]
Script launches multiple Terminals w/ incorrect path
Authored by: liyanage on Oct 31, '01 09:09:36AM

Can you try this:

http://www.entropy.ch/software/applescript/OpenTerminalHereDebug.sit

and tell me (via email) what the two dialog boxes that will pop up say?



[ Reply to This | # ]
Script launches multiple Terminals w/ incorrect path
Authored by: vaag on Oct 31, '01 01:28:02PM

First, as demmer12 I have a Terminal alias in my Dock. The script is in ~/Library/Toolbar Scripts.
The description of demmer12 is almost exactly what happens over here, with one exception: pwd returns the parent directory of the one I'd selected, where ever I am!
Now, activating your OpenTerminalHereDebug-script, what happens is (after I'd selected my home directory) :
-a second Terminal icon opens in the Dock, the first one is not been activated yet;
-an alert box appears, text "map" [Dutch for "folder"] and cancel/ok;
-when I click ok, there's an alert sound, nothing happens;
-when I click the second Terminal icon in the Dock an alert box appears, text ":Users" and cancel/ok;
-when I click ok the first Terminal icon is been activated and two Terminal windows open, the ordinary one with the "Welcom to Darwin!" text and another with the window title "/Users/" and pwd of /Users So again, it returns the parent directory!



[ Reply to This | # ]
Script launches multiple Terminals w/ incorrect path
Authored by: liyanage on Oct 31, '01 06:30:10PM

Ahh, I think we have a misunderstanding here:

1.) You cannot *select* something and then click the toolbar script icon to open
a terminal window inside the selected object. A click on the icon always opens a
shell in the window that *contains the button* in its toolbar, *not* in the selected folder.
What you want can be accomplished by dropping the item in question onto the toolbar script icon.

2.) The "second" Terminal icon you're seeing in the dock is actually the AppleScript application launching. It will in turn launch the real Terminal application and then terminate itself.
The big problem here is that I just "borrowed" the original icon of the Terminal app, which
is very confusing because it looks like there are two Terminal applications running. I will change the icon ASAP.

3.) the Terminal application has the habit of opening a new terminal window whenever it is being
launched or sometimes when it's being brought to the front. This is probably why you're seeing two new terminal windows pop up. One is opened by the Terminal application after it's launched, the other one is the one you want, the one that was created by the AppleScript application.



[ Reply to This | # ]
Working
Authored by: demmer12 on Oct 31, '01 08:28:21PM

Now that we understand each other, all is well. Many thanks!!!

I'm usually good at considering most possibilities, such as the
script being the "other" Terminal bouncing in the Dock, but that
one went right on by. I agree that the script icon should be
changed, but keep a Terminal theme if you can, like putting a
small script image atop the terminal.

Thanks again!



[ Reply to This | # ]
Script launches multiple Terminals w/ incorrect path
Authored by: nagani on Oct 31, '01 09:07:25PM

You can avoid the double terminal windows:

In Terminal Preferences/Startup, select "Do nothing" rather than "Open a new window". Terminal will not open a new window when you launch it from the Finder, but it will if you click its icon in the Dock... (isn't this behavior close to a bug?) I use(d) Snard to launch Terminal with this preference, and it also opens a new window.

Thanks Marc for this script! This and the <tt>open .</tt> hint do impress my colleagues!



[ Reply to This | # ]
Script launches multiple Terminals w/ incorrect path
Authored by: vaag on Nov 01, '01 06:07:45PM

>1.) You cannot *select* something and then click the toolbar script icon to open
>a terminal window inside the selected object. A click on the icon always opens a
>shell in the window that *contains the button* in its toolbar, *not* in the selected folder.
>What you want can be accomplished by dropping the item in question onto the toolbar script icon.

Frankly, selecting an item and clicking the toolbar script icon gives me the same terminal window result as dropping the item onto the toolbar script icon.
Also, in practice, I often open a terminal window and change directory by typing cd and dropping the folder I want to cd to in the terminal. It would be nice if you could simply select this folder in the finder and then click onto the toolbar script icon to get the same result (instead of cd to the parent directory).
But then I think, it's just simply getting used to it.
Thank you,
Vincent



[ Reply to This | # ]
Script launches multiple Terminals w/ incorrect path
Authored by: demmer12 on Oct 31, '01 09:15:23AM

My experiences mirror those of vaag. I won't be able to try your suggestions until this evening, but I will post my results. I appreciate your sense of pride in your work and the support you've offered on these pages.



[ Reply to This | # ]
Some details
Authored by: demmer12 on Oct 31, '01 09:27:45AM

Sorry that I left these out of the previous post.

I did a clean install of 10.1 (erase and install): I expect that I have only one Terminal binary.

I have a Terminal alias in my Dock. Upon clicking the toolbar script, another one appears, then the one I keep in the Dock bounces, the second disappears, then the two Terminal windows open as I said before. In my case, no matter where I am (though I've only tried this from various subtrees in my home directory) the results of pwd are /Users/craig.

The first Terminal window that appears is the one that I would have if I simply clicked on the alias I keep in the Dock: it's contents are "Welcome to Darwin!" followed by a prompt on the next line. The second window's title contains "cd '/Users/craig';clear". pwd returns /Users/craig.

I placed the script in ~/Library/Scripts.

HTH



[ Reply to This | # ]