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


Click here to return to the 'The long way?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
The long way?
Authored by: pmccann on Feb 05, '04 06:50:47PM

Here's a much shorter example which might highlight what's going on a little better:

osascript<<END
tell app "Finder" to open ("$1" as POSIX file as alias)
END

Save this as "pmo" (for "poor man's open") or whatever in your ~/bin directory --assuming that /Users/yourusername/bin is in your PATH-- make it executable (chmod u+x ~/bin/pmo), enter "rehash" to get it found and you should be able to do something like

pmo filename.txt

or

pmo ~/bin/pmo

and so forth. (The Finder should use the correct app to open the file.) As promised by the name, it's a pretend "open" command.



[ Reply to This | # ]
The (really!) long way?
Authored by: Krioni on Feb 06, '04 09:45:34AM
Wow. Or you could just use the actual 'open' command. Type

man open
in the Terminal. It opens a file the same way the Finder would, but also lets you 'open' URLs, specify an app, or whatever. No need for "poor man's open" I think.

[ Reply to This | # ]
The (really!) long way?
Authored by: pmccann on Feb 09, '04 06:54:31PM

Oh really? To think that I hadn't noticed. Thanks so much for open-ing my eyes. Now I can go off and recreate some other wheels.

Sheesh...



[ Reply to This | # ]