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


Click here to return to the 'Using open (again...)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using open (again...)
Authored by: pmccann on Dec 31, '02 09:52:02AM

Nice set of tips (uggg...), but the open command is much more fun if you exploit all of its magic: instead of

open /Applications/Netscape

(where you need a path and the capitalization) use

open -a netscape

and let open do the searching for you. Similarly

open -a console

finds console.app in the /Applications/Utilities directory, and

open -a "project builder"

will find Project Builder.app in the /Developer/Applications if you've installed the Developer Tools. The quotes are necessitated by the space in the name of the latter application.



[ Reply to This | # ]
Using open (escaping spaces etc)
Authored by: helary on Jan 08, '03 10:04:56PM

the terminal does not need "" to take spaces or other special characters into account.

just escape them with anti-slash (\\).

thus:

open -a "project builder"

becomes:

open -a project\\ builder



[ Reply to This | # ]
Using open (escaping spaces etc)
Authored by: Moofisto on Jan 24, '03 09:20:34PM

Oops, I figure you were trying to make the backslash show up on this page by escaping it with another backslash. In my browser, I'm seeing both backslashes.

Of course, when typing these in the Terminal, there should be only one backslash.



[ Reply to This | # ]
Using open (again...)
Authored by: krishna on Feb 20, '03 01:18:09AM

Yup -- I only discovered one more gotcha: when I type

open -a itunes

it starts itunes in classic. I have to type

open -a itunes.app

to have it run the macosx version of itunes (which it does just
fine). That, plus turning on the ssh server, and this tcsh
alias (should all be on one line):

a tell 'osascript -e ' "'" 'tell application ' '"''\!:1''"' "'" ' -e ' "'" '\!:2-$' "'" '
-e "end tell" &';

means I can type:

ssh -C krishna@mymac.address.com
<enter password>
% open -a itunes.app
% tell itunes play

(this track is not that great, so I skip it:)
% tell itunes next track

(I want to play this one again)
% tell itunes previous track

(phone call!)
% tell itunes pause

and voila! Full remote control of itunes ... and probably other apps.
osascript is definitely a must-mention for any unix conversions.



[ Reply to This | # ]