[X-Unix] Hiding apps from the command line

Eugene Lee list-themacintoshguy at fsck.net
Fri Mar 26 05:59:09 PST 2004


On Fri, Mar 26, 2004 at 02:09:40PM +0100, Kirk McElhearn wrote:
: 
: 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.

I'm not getting any errors so far.  What did you type to get the error,
and what was the error message?

BTW, here's a revised version based on your script, shortened in a few
spots for brevity's sake.

------------------------------ start here ------------------------------

#!/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
    else if "$1" is "f"
        set visible of application process "Finder" to false
    else if "$1" is "o"
        set visible of every process whose visible is true and name is not "$2" to false
    else if "$1" is "t"
        set visible of every process whose visible is false to true
    else 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

------------------------------ stop here ------------------------------


-- 
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/



More information about the X-Unix mailing list