Prepare for the skinny on how to build a AppleScript to allow for quick resolution changes. This is quite useful if you like to use different resolutions for applications, or if you have TV-out, like I do (which works in only certain resolutions).
After many weeks of learning the power of AppleScripting, I have finally integrated my OS X machine into my living room entertainment system. Largely due to the TV out on the ATI Xclaim, and the Keyspan Digital Media Remote (which I recommend everyone get, because it's sheer genius). The ATI card is selling for peanuts now as it is a few years old, and the DMR isn't very expensive either. I bought my card second hand, and had little help with the setup ... hence this hint for my fellow ultra-geeky peers. This was essential, since the Xclaim card can only output to TV at 800x600|60hz, while I like to use 1280x960|100hz when working on the machine.
First, you will need cscreen, a command line utility to allow screen changes. Once you have it, install it with sudo cp ./cscreen /usr/bin in the Terminal (note you dont have to put it in /usr/bin, but you will have to run it from your script ... and if it's elsewhere, you'll have to make a direct call to it).
Next, create this script:
on run
do shell script "cscreen" (*get current resolution*)
set screenResolution to the result
if screenResolution contains "1280" then
tell application "Stickies" to quit
(* because im tired of having
to organize all my stickies every time I switch*)
(*switch to dual [tv/mon] display*)
do shell script "cscreen -x 800 -y 600 -r 60"
else if screenResolution contains "800" then
(*switch to monitor display*)
do shell script "cscreen -x 1280 -y 960 -r 100"
end if
end run
It's not rocket science to figure out how you can customize the script to enjoy your favorite settings. All it currently does is flip-flop between my two resolution choices. Now if you want to go one step further, check out Xkeys, which allows you to assign a script to the function keys -- so when I push Command-F1, the script above gets run, from any application. There's nothing nicer than chilling with a good party shuffle, some red wine, and the G-Force visuals (available for any MP3 software), especially now that I can kick back and control the tunes or videos from the remote while anywhere.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040908141042786