Sure you can make the Terminal transparent by clicking command+i followed by clicking color, then moving the slider until the Terminal window is transparent ... but have you ever thought, hmmm, I wish that I could toggle the transparency on the Terminal with just the click of a button? Or, I would like to quickly see what is going on behind my Terminal window.
Well, here is a simple AppleScript that will do just that. You need to check the "Enable access for assistive devices" box on the Universal Access System Preferences panel in order to use the script. Assign the script a hot key in your favorite launcher, and toggle transparency until your heart is content. The script runs on Panther using tcsh; I am not able to verify it on Jaquar or future OSes or other shells.
tell application "Terminal" to activate
tell application "System Events"
tell application process "Terminal"
(* This just hit command i which opens the information preference pane *)
key down command
delay 1
keystroke "i"
key up command
(* This will click on the popup button Color where the ¬
slider transparency is located. *)
delay 1
click pop up button 1 of window "Terminal Inspector"
delay 1
click menu item "color" of menu "OtherViews" of pop up button 1 of
window "Terminal Inspector"
delay 1
get value of slider 1 of group 1 of window "Terminal Inspector"
(* This toggles the transparency. You can set the transparency (95) and ¬
opaque values (0) to anything you like. *)
if value of slider 1 of group 1 of window "Terminal Inspector" is 0 then
set value of slider 1 of group 1 of window ¬
"Terminal Inspector" to 95 -- This is transparent
else
set value of slider 1 of group 1 of window ¬
"Terminal Inspector" to 0 -- This is opaque
end if
(* This closes the preference pane window *)
click button 1 of window "Terminal Inspector"
end tell
end tell
Of course, you can do a lot of other things with this script like prompt for a dialog box and enter a slider value, or change background color, etc. This is just one example of how to access the feature rich preference pane box of Terminal that wouldn't otherwise be scriptable without a GUI scripting application. A fun thing to do with the script is to test it right from the hint. Simply select the code, click on services in the menu bar, select Script Editor, click on Run as AppleScript.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040812022357279