Caps Lock
My script needs to see if caps lock is on or off
Solution can be plain AppleScript thing or unix thing.
Thanks
Solution can be plain AppleScript thing or unix thing.
Thanks
MacBook Pro, Mac OS X (10.6.1)
MacBook Pro, Mac OS X (10.6.1)
#include <Carbon/Carbon.h>
int main (int argc, const char * argv[]) {
unsigned int m = GetCurrentKeyModifiers();
printf("%u ", m);
return 0;
}
cd ~/Desktop
gcc -framework Carbon -o GetCurrentKeyModifiers GetCurrentKeyModifiers.c
./GetCurrentKeyModifiers
--SCRIPT
do shell script ("~/Desktop/GetCurrentKeyModifiers")
set n to result as number
set _capslocked to n div 1024 mod 2 = 1
--END OF SCRIPT
Event Modifier Constants
enum {
activeFlagBit =0,
btnStateBit =7,
cmdKeyBit =8,
shiftKeyBit =9,
alphaLockBit =10,
optionKeyBit =11,
controlKeyBit =12,
rightShiftKeyBit =13,
rightOptionKeyBit =14,
rightControlKeyBit =15
};
typedef UInt16 EventModifiers;
Caps Lock