If you'd like to see the script, read the rest of the article.
A good place to store these user-specific scripts is in a 'bin' directory in your user's home diretory. Your path is already set up to look there (type 'echo $PATH' to see it). If you don't have one, just create a folder named 'bin' at the same level as Documents, Movies, etc. Once you've done that (in the Terminal or the Finder), open a Terminal and 'cd ~/bin'.
The first step is to create the script. Type 'pico openApplication' (or use your favorite editor, or even TextEdit in the Finder) to launch the editor, and then paste in the following (note the first line is just a colon by itself!):
:Save your changes, making sure the script winds up in the ~/bin directory. In the Terminal, type "chmod +x ~/bin/openApplication" (this makes the script executable) and then 'rehash' (tells the shell to find new programs).
# @(#) --Opens an application if found in /Applications folder BC 10/01
APPDIR="/Applications/"
SUFX=".app"
APPNAME=$1
if [ -e $APPDIR$APPNAME$SUFX ]
then
#if there is more than one argument assume that it is a file to be opened
if [ $# -gt 1 ]
then
shift
echo found $APPNAME$SUFX
echo Attempting to Open application along with $# Files
open $APPDIR$APPNAME$SUFX $*
else
echo found $APPNAME$SUFX
echo Attempting to Open application
open $APPDIR$APPNAME$SUFX
fi
else
if [ $# -eq 0 ] #if no arguments were given show proper usage
then
echo
echo usage openApplication applicationName [ filename1 filename2 ... ]
else # Show some stuff to help out
echo
echo $APPNAME Not found in /Applications Folder
echo
echo Capitalization is Important!!
echo
echo Do not add .app to the Name, I\'ll do it for you
echo
echo Here is a list of applications in your /Applications folder
echo
echo /Applications/*.app
fi
fi
You can now type "openApplication TextEdit", for example, to launch TextEdit. Big deal you say -- typing out 'openApplication' isn't much shorter than typing out the path in the first place. But a quick alias takes care of the problem. Add the following line to your aliases.mine file (in ~/Library/init/tcsh, which you may have to create if it doesn't exist):
alias o `openApplication`Of course if you are already using 'o' as an alias for something else, choose another shortcut letter. To see what aliases you are using, type 'alias' with no arguments and hit enter. Once you've put the alias in the aliases.mine file, close and open the Terminal. Now you have the command 'o' at your disposal in any Terminal window.
(If you need more help with the aliases.mine file, just search macosxhints for a 'aliases.mine')
How to use the script:
Type "o [application name], without .app appended, and the path of any files you want the application to open. Remember, this only works for apps in the /Applications directory. Some examples:
o TextEdit--will open TextEdit
o TextEdit ~/Documents/note.txt--will open the document note.txt with TextEdit. You can add as many files as you wish, if a filename has a space in it enclose the filename in quotes.

