I use a PC usb keyboard with my macbook. So, I've gone into System Preferences > Keyboard > Modifier Keys
… and swapped command and option for the usb keyboard. This puts those keys in the "correct" position for a mac.
But, for part of the day, I remote desktop to a windows machine. So now, I need to swap the keys back, so the remote desktop client isn't confused.
It's easy enough to do this through the Preferences UI, but its cumbersome.
I'd like to use a script of some kind (maybe applescript), so I could quickly swap back and forth.
I've found several scripts online, but none of them are for Lion.
Best Answer
I was able to modify some of the scripts already out there, and get them to work in Lion. To create these scripts:
Here is the script to swap command to option, and option to command:
Here is the script to swap them back:
To make these scripts easy to access, you can go to Applescript Editor Preferences and check "Show Script menu in menu bar". Then, copy your scripts to your home directory Library/Scripts directory, i.e. /Users/ryan/Library/Scripts
Now you can access them right off the menu bar script menu.