Turn off CapsLock after detecting its state?

I use StefanK’s superb “checkModifierKeys” to alter the behavior of my scripts when they launch, as discussed here

http://macscripter.net/viewtopic.php?id=29456

When I press CapsLock before launching a script, I would like the script to turn off CapsLock after detecting that it is switched on. I can’t find any way to change the CapsLock state via AppleScript or a shell script. Does such a thing exist? (It’s trivial in Windows, but I can’t find a way to do it under OS X.)

Thanks for any help.

Hi,

as far as I know it’s not possible to set the Caps Lock state programmatically.
You can control the LED, but it does not affect the real state

You’re clearly right. So I stopped using CapsLock and use Cmd-Option instead as a “trigger.” Thanks again for that very useful utility program!