|
|
Am I missing something...
or is all of this kind of a waste of time?
First of all, the original poster suggested you call the script 'openApplication' Then, to avoid having to type openApplication all the time, he says you should alias it to 'o'. Is there some reason for not calling the script 'o' in the first place? Second, and perhaps most important, it seems to me that all this script does is reduce the functionality of the open command. open, on its own, is case-insensitive, handles spaces in app/file names (just quote them), opens Carbon applications (which don't have an '.app' extension), and, best of all, it automagically searches down in to your entire Application tree to find the app in question (This includes /Applications ~/Applications and even /Developer/Applications. I presume it also searches /Network/Applications, but I can't test this on my setup.) So for example, the command open -a "appleworks 6" ~/documents/budget.cwk executed from any directory, opens my Budget in AppleWorks, which resides in "/Applications/Productivity/Office/AppleWorks 6/Appleworks 6.app". open -a "quartz debug" will open "/Developer/Applications/Quartz Debug.app" open -a "contract timer" will open "~/Applications/Contract Timer" which is a Carbon app in my home app folder (which must be called Applications). As a matter of fact, open -e readme will still open the readme with TextEdit, even though it now lives in "/Applications/Productivity/Editors/TextEdit.app". (The man page states it must live in /Applications) So, unless someone can demonstrate that I am an idiot, and you are looking to save a few keystrokes, I would recommend that you just alias o 'open -a' This will let you open iTunes by typing o itunes regardless of where you moved it, as long as it's still downstream of an Applications folder that resides in '/' '~/' '/Developer/' or '/Network' Furthermore, open also uses the "default" application defined in the Finder to open files. So in the first example, you could just type open ~/documents/budget.cwk and open will use AppleWorks automatically. Like I said, if I'm missing something, let me know, but I just tested all of these tips and they all work on my 10.1 iBook466. P.S. Can anyone get StuffIt Expander to open on a remote machine? The open command works on a local box, but on a remote, it always reports kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
Yes :-)
Locating an application by name does not work if you've renamed the
Perhaps,but...
I renamed ~/Applications/Xoptimize/Xoptimize to Xoptimize2 in the Finder then used the duplicate menu item on it. Then, in the terminal, I executed
o xoptimize2 This opened two copies of Xoptimize side by side. I didn't have to log out or even rehash. They both still thought they were called Xoptimize, but they operated independently of each other. (X rules) I don't disagree that your program looks pretty cool. The 'open owner of this pref' option seems interesting enough on its own. I'm just saying that for opening apps and their data files from the terminal open does the job pretty well. And as far as breaking all your old scripts when you update/rename your app, just run the scripts through sed. Besides, that's why you shouldn't put version numbers in the bin name. BTW, is your app called launch or FindApp? :-)
Am I missing something...
The long name of the script is just to reduce confusion when I want to edit, remove or replace a script. As for your second point... not having to type the full path name.. Your right. I have already quit using this script. Is this new to 10.1? Before upgrading I am pretty sure I had to type the full path.. hence the script. Thanks for pointing that out, I would have gone on using my "limited features" script.
New to 10.1?
I'm pretty sure that it has always been this way. I don't recall ever typing a path myself. I reread the man page just now (still dated Mar. 24, 2001) and it states
You can specify one or more file names (or pathnames), which are interpreted relative to the shell or Terminal window's current working directory. Perhaps this line caused your confusion. At first glance, it seems to be telling you to specify any needed pathnames, but I think this line only refers to the file argument not the application arg. Since it uses the "default" app automatically if unspecified, this means it already had some ability to search on its own. It is possible that open 10.0.x only searched '/Applications' (where 98% of my apps reside) and not the other appdirs, like '~/Applications', but I kind of doubt it, since all four appdirs have always been considered part of the Application tree. See Inside Mac OS X: System Overview pages 166 and 242. I have been meaning to install X on my parent's iMac. Whenever I finally get around to it, I'll test this before I upgrade them to 10.1 as post back here. Unless someone out there is still running 10.0.x and can beat me to the punch. (What's wrong with you anyway? X.1 rules! ;-) ) P.S. You can even use a directory as the file arg and open will open a new Finder window in that directory.
open ~ If the specified directory is already the focus of a Finder window, Finder will bring that window to the front rather than open a new one.
New to 10.1?
I figured out why I had to type the whole path-- I wasn't using the -a option! so i was using |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.07 seconds |
|