#!/bin/sh
#
#  openhide.sh, a bash script by duus made on Mon Jul 23 12:20:10 EDT 2007 
#  lives in: ~/Documents/Software/unixscripts//system/openhide.sh 
#  run binedit openhide to edit.  see binedit help for more information
#
_SCRIPT_NAME=openhide             
_SCRIPT_LOCATION=~/bin/             
#             
if [ "$1" = "version" ]                
	then                                 
	echo " openhide by duus"          
	echo " ~/Documents/Software/unixscripts//system/openhide.sh "
	else                                 
# --- normal script here ---  
if [ "$1" != "s" -a "$1" != "silent" ]
	then
#h <s>ilent does w/out echo         
echo "open then hide $*"
else
shift
fi

echo | osascript <<EOF
tell application "System Events"
	set process_list to name of every process
	if process_list does not contain "$*" then
		try
			tell application "$*" to activate	
		end try
	end if
	set visible of process "$*" to false
end tell
EOF
 
# -------------------------- 
# 
fi # end 'version' 
# 
# end openhide, ~/Documents/Software/unixscripts//system/openhide.sh

