Launching an application via script

Joined
Mar 24, 2008
Messages
6
Reaction score
0
Points
1
Hi there,

I'm a member of the popular "virtual world" Second Life which I like for building and chatting to my friends in, however, as a builder I have multiple accounts for it, and would like to create shortcuts that let me launch Second Life with appropriate command-line arguments to log me in directly.

The Second Life application itself has a simple set of command-line arguments for just such a case.

Now, I've managed to create a solution using Apple Script, but it isn't quite ideal yet. Here's the apple-script I'm using:

Code:
tell application "Terminal"
	do script "\"/Applications/Second Life.app/Contents/MacOS/Second Life\" -multiple -login <first-name> <second-name> <password>"
end tell

Nothing too complicated. However, the problem with this is that when it executes, it causes Terminal to open and display a window, which I don't really want. What I'm looking to do is execute the exact same instruction in a way that will invisibly execute my command, so all that happens in the end is that Second Life opens up.

I've also tried the same thing using Automator, but I end up with the automator "Run shell script" item appearing in my menu-bar which isn't ideal either (and which I can't figure out how to hide, bah!).

Is there a way to have my apple-script prevent the terminal opening in this way, or executing the script some other way? Or alternatively, is there something else I can use to do this, such as a simple program I could compile?

Thanks for any help!
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
See my response here.

Searching the forum before asking is a great idea because you may answer your question quickly and get on with your task. Plus you wouldn't be using other peoples time.
 
OP
H
Joined
Mar 24, 2008
Messages
6
Reaction score
0
Points
1
Searching the forum before asking is a great idea because you may answer your question quickly and get on with your task. Plus you wouldn't be using other peoples time.
Thank you for the link, it solved my problem.

However, please do not be so quick to assume someone didn't search for an answer just because one does exist in the forum. I tried Google, and I tried this forum's search engine; nothing I searched for came up with anything that helped, which is why I posted this thread.

I may be new here but I'm not new to forums, I've moderated several for the better part of eight years in my spare time.

Your intention may not have been to be rude, but it's much more helpful just to say "Here's a topic that should help, I found it in a search for X, Y, and Z". This has the added benefit of letting the user know a bit more about the problem, since I, while tech savvy (a Java programmer), do not know what the best thing to search for would be. Heck, I wouldn't have expected an answer in the thread you linked to; to me the title suggests "how to just run a terminal script", it suggests nothing about hiding it etc.
Also, this way the keywords in your reply, combined with the keywords in the user's post, make it much more likely people will find relevant results more quickly in future :)
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Glad to here the link solved your problem.

I'm trying to get people to be more proactive on their own. Since I didn't know what your action was before posting, the search was a good suggestion. So many people don't bother as I'm sure you are aware, based on your experience with forums. I've been accused of being too direct at times, so I'm sure I could be more tactful at times.

Your constructive domain language lesson for the day; AppleScript is one word and the S is capitalized. As a technical person you understand the value of being this exact, so don't think I'm trying to talk down to you.

...it's much more helpful just to say "Here's a topic that should help, I found it in a search for X, Y, and Z".

So if I had said "Please see this thread titled 'Basic Terminal Automation' that can be found with the search words 'AppleScript Terminal script' within this forum.", that would have been more to your liking. I actually like that. :) It doesn't assume one didn't do a search, it places key words in the response, and gives a subtle hint to others how to do a search.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top