[X-Unix] Hiding apps from the command line
Simon Forster
simon-lists at ldml.com
Fri Mar 26 07:08:09 PST 2004
On 26 Mar 2004, at 13:59, Eugene Lee wrote:
> BTW, here's a revised version based on your script, shortened in a few
> spots for brevity's sake.
I'm sorta glad you told me about this. I've started to play with this
and found it educational but... displacement activity. What about that
report I've been meaning to get written for the past _2_ weeks.
<sigh />
The error seems to get thrown if the second command line arg is not
given - whether it's needed or not.
FWIW, my take on the script:
---------START----------
#!/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 -v [appname] - shows specified app
# hide -t - toggles shown apps
# hide -x - shows terminal
# hide [appname] - hides specified app
#
# 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" begins with "-" then
if "$1" contains "o" then set visible of every process whose visible
is true and name is not "$2" to false
if "$1" contains "a" then set visible of every process whose visible
is true and name is not "Finder" and name is not "$2" to false
if "$1" contains "f" then set visible of process "Finder" to false
if "$1" contains "v" then tell me to tell application "$2" to
activate
if "$1" contains "t" then
set theVisible to name of every process whose visible is true
repeat with theProcess in every process
if theVisible contains name of theProcess then
set visible of contents of theProcess to false
else
set visible of contents of theProcess to true
end if
end repeat
end if
if "$1" contains "x" then tell application "Terminal" to activate
else if exists application process "$1" then
set visible of application process "$1" to false
end if
end tell
END
-----------END----------
Simon Forster
_____________________________________________________
LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
Tel: +44 (0)70 9230 5244 Fax: +44 (0)70 9230 5247
_____________________________________________________
More information about the X-Unix
mailing list