[X-Unix] Hiding apps from the command line

Kirk McElhearn kirklists at wanadoo.fr
Fri Mar 26 04:43:48 PST 2004


On 3/26/04 1:15 PM, "Eugene Lee" <list-themacintoshguy at fsck.net> wrote:

> The options might be like:
> 
> -o    Hide all applications other than "appname".
> -a    Hide all applications.
> -f    Hide the Finder.
> 
> where -o and -a by default do *not* hide the Finder.

Waddya know... I didn't think I'd be able to figure this out, but it seems
to work.

Save as "hide". 

Syntax:

hide o [appname] - hides all other apps
hide a - hides all apps but Finder
hide f - hides Finder
hide [appname] - hides specified app

#!/bin/sh
osascript <<END
    tell application "Finder"
    if "$1" is "a"
        set visible of every process whose visible is true and name is not
"Finder" and name is not "$1" to false
    end if
    
    if "$1" is "f"
        set visible of application process "Finder" to false
    end if
    
    if "$1" is "o"
        set visible of every process whose visible is true and name is not
"$2" to false
    end if
    
    if exists application process "$1" then
        set visible of application process "$1" to false
    end if
    end tell
END


Note that all the "set" lines should be single lines.

Any comments?
 
 
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