[X-Unix] Hiding apps from the command line

Kirk McElhearn kirklists at wanadoo.fr
Fri Mar 26 05:09:40 PST 2004


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

> 
> "END" is not the same as "end".  You have some whitespace characters at
> preceding the second "END" string delimiter.

Fixed it.

Check this out - talking with Rob Griffiths, he made some feature requests.
However, even though it works, I'm getting an error. Try it and see if you
know why.




#!/bin/sh
# This script lets you hide a specified application, the Finder, all
applications
# but the Finder, or all applications other than a specified application.
# Syntax is as follows:
# 
# hide o [appname] - hides all other apps
# hide a           - hides all apps but Finder
# hide f           - hides Finder
# hide [appname]   - hides specified app
# hide v [appname] - shows specified app
# hide t           - shows all apps
# 
# For applications whose names contain spaces, they must be quoted, ie, hide
"microsoft word".
# This command is case-insensitive.

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 "$1" is "t"
        set visible of every process whose visible is false to true
    end if

    if exists application process "$1"
        set visible of application process "$1" to false
    end if
    
    end tell
END
    
osascript <<END
    if "$1" is "v"
        tell application "$2"
        activate
        end tell
    end if
END





 
 
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