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


Click here to return to the 'A better way (soon)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A better way (soon)
Authored by: sabi on Nov 10, '01 05:29:34PM
I'm working on a replacement for 'open', to be called 'launch'. The help message may give you some idea of what it does (most of the functionality is there now, I just need to rearrange things so it opens by default, add a couple of features, and I'll release it):

[p6:1] ~%FindApp                                                         4:24PM
usage: FindApp [-opsbmhCX] [-c creator] [-i bundleID] [-u URL] [-n name] [document ...]
   or: FindApp [-oplsbmhCX] item ...
  -o            attempt to launch target(s) instead of printing paths/URLs
  -p            print document(s) instead of opening them
  -l            launch URLs (e.g. treat http:// URLs as Web sites, not WebDAV)
  -s            launch target(s) as superuser (authenticating if needed)
  -w            wait for application to finish opening before exiting
  -b            launch application in the background
  -m            launch application again, even if already running
  -h            hide application once it's finished opening
  -C            force CFM Carbon application to launch in Classic
  -X            don't start Classic for this app if Classic isn't running
  -c creator    match application by four-character creator code ('ToyS')
  -i bundle ID  match application by bundle identifier (com.apple.scripteditor)
  -u URL        open item with file:// URL (NOT RECOMMENDED for scripts)
  -n name       match application by name (NOT RECOMMENDED, very fragile)
'document' may be a file, folder, or disk - whatever the application can open.
'item' may be a file, folder, disk, or URL.
Some examples:
[p6:4] ~%FindApp -i com.barebones.BBEdit                                 4:26PM
/Volumes/GrayApps/Applications/BBEdit 6.1.2/BBEdit for OS X
[p6:5] ~%FindApp -c 'R*ch'                                               4:28PM
/Volumes/GrayApps/Applications/BBEdit 6.1.2/BBEdit for OS X
[p6:6] ~%FindApp -n 'Disk Copy'                                          4:28PM
/Applications/Utilities/Disk Copy.app
Here's an example of how to use it as a script to launch BBEdit (pre 6.5).
[p6:3] ~%which bbedit                                                    4:26PM
bbedit () {
        for f
        do
                if [[ ! -f $f ]]
                then
                        echo "n" > $f
                fi
        done
        FindApp -oi com.barebones.BBEdit $@ 2> /dev/null
}
Using bundle identifiers (i.e. com.barebones.BBEdit) is a nice, human-readable way to specify applications compared to creator code, and it's robust if the application changes its name (modulo some LaunchServices bugs that I've reported to Apple...).

[ Reply to This | # ]
Released! (sort of)
Authored by: sabi on Nov 15, '01 02:51:55PM

I've released an alpha version of launch for testing, please download
and let me know what you think.

http://web.sabi.net/nriley/software/



[ Reply to This | # ]