[X-Unix] Hiding apps from the command line
Kent Harris
ksh at vine.com
Fri Mar 26 10:02:40 PST 2004
Here's how us old farts do it:
#! /bin/sh
#***********************************************************************
*****
#***********************************************************************
*****
#
# Install this script as "~/bin/hide" with 0755 permissions.
#
# trap 'rm -f /tmp/hide$$; exit 1' 1 2 3 15
#
PROG=`basename $0`
VERSION="1.0"
# VERSION="$Id$"
USAGE="eval echo usage: $PROG [options] application; grep \"^#@\" $0 |\
sed s/#@//; exit 1"
#@ hide app => hide specified application "app"
#@ hide -a[ll] => hide all applications but the Finder
#@ hide -a[ll] app => hide all but specified application
#@ hide -r[eveal] => reveal all applications
#@ hide -r[eveal] app => reveal specified application
#@ hide -v[ersion] => print version and exit
#@ hide => print this usage message
# Validate command line arguments.
CMDLINE=$*
until test -z "$1" ; do
case $1 in
-a*) CSTR="every process whose visible is true and name is not
\"Finder\" to false";;
-r*) CSTR="every process whose visible is false to true";;
-v) echo ${VERSION}; exit 0;;
-*) $USAGE;;
*) APPLICATION="$*"; break;;
esac
shift
done
[ "${CSTR}" -o "${APPLICATION}" ] || $USAGE
if [ "${APPLICATION}" ] ; then
CSTR="application process \"${APPLICATION}\" to false"
set -- $CMDLINE
until test -z "$1" ; do
case $1 in
-a*) CSTR="every process whose visible is true and name is not
\"${APPLICATION}\" " ;;
-r*) CSTR="application process \"${APPLICATION}\" to true";;
*) break;;
esac
shift
done
osascript<<XXX
tell application "Finder"
if exists application process "${APPLICATION}" then
set visible of ${CSTR}
end if
end tell
XXX
else
osascript<<YYY
tell application "Finder"
set visible of ${CSTR}
end tell
YYY
fi
More information about the X-Unix
mailing list