Hiding apps from the command line

Kirk McElhearn kirklists at wanadoo.fr
Fri Mar 26 03:12:33 PST 2004


Very cool discussion, this. Here's the text I've written up for the next
edition of Mac OS X Hints:

15-1          Hide an Application from the Command Line
Here's the scene: you're working in Terminal, and you've got lots of other
windows behind the Terminal window. You want to get some of them out of the
way, and you can naturally do so from the Finder. But why not find a way to
do this from the command line?

Here's a shell script, by Eugene Lee, that fits the bill:
 
#! /bin/sh
# hide an application in the Finder
osascript <<END
      tell application "Finder"
      if exists application process "$1" then
            set visible of application process "$1" to false
      end if
      end tell

As usual, save this script, with a name such as hide, in a directory that's
in your PATH, make it executable by typing chmod 755 hide, then you can run
it as follows:

hide [application name]

You'll need to type the actual application name that the Finder recognizes;
move your cursor over the Dock to see: for example, Microsoft Word is the
full name of the Office word processor, and you need to use quotes around
any application name that contains spaces:

hide "Microsoft Word"

You don't need to respect case; this works even if you type hide safari, for
example.

*********

You'll not that I put END on the first line, and that you don't need to have
another END at the end.

Can we take this further and find a way to hide all other applications from
this script?
 
 
Kirk
 
        My latest book: How to Do Everything with Mac OS X Panther
                  http://www.mcelhearn.com/htde.html
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 . . . . . . .  kirk at mcelhearn.com | http://www.mcelhearn.com  . . . . . .
 . .  Kirk McElhearn | Chemin de la Lauze | 05600 Guillestre | France  . .



More information about the X-Unix mailing list