From time to time, I need to take a peek at the Keyboard Viewer, but I despise having the Input Menu in my menu bar since it serves no other purpose for me and just takes up space. And for whatever reason, the Input Menu is the only keyboard extra to make heavy use of color, which I find distracting. Anyway, there's an application called "KeyboardViewerServer" located at /System -> Library -> Components -> KeyboardViewer.component -> Contents -> SharedSupport. Running this app opens the Keyboard Viewer pallete. However, if this app is already running (it is not quit when the pallete is closed) then "opening it has no effect."
So I wrote a short AppleScript that checks to see if this process exists, quits it if it does, and then launches KeyboardViewerServer. It's worked perfectly for me. I saved the script as an application, called it "Keyboard Caps" and put it in my Utilities folder. Now I can finally get rid of the input menu. Here's the script.
tell application "System Events"
if exists process "KeyboardViewerServer" then
try
quit application "KeyboardViewerServer"
end try
end if
end tell
tell application "Finder"
-- NOTE: Enter the following two lines as ONE LINE without spaces!
open item "System:Library:Components:KeyboardViewer.component:
Contents:SharedSupport:KeyboardViewerServer" of the startup disk
end tell
Now "Key Caps" is back in its original location.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040218181307147