Changing the state of the Caps Lock key via a script

Hello all,

I’m looking for a way to change the state of the Caps Lock key via AppleScript in both OS X and OS 9. It can be 2 separate scripts (one for OS 9 and one for OS X).

This AppleScript would be called from within a FileMaker file/runtime.

I researched long and hard and can’t find a way to do it… any help is GREATLY appreciated.

Thanks

cin

Somethin like this? obviously you don’t want them both at one time lol, but whatever :smiley:

tell app "System Events"
	key down Shift
	Key up Shift
end tell

Hi Ugrax, thanks for the tip. Unfortunately the script you suggested will virtually press the SHIFT key up and down. I’m looking for the same thing but for the Caps Lock key. I’ve considered the way you’ve suggested before posting but couldn’t find a way to make it work for Caps Lock…

Thanks anyway :slight_smile:

Cheers

cin

The idea here is to tell application “System Events” to hold down shift while you do other stuff, and then at the end, let it up. The caps lock key is equivalent - it just “holds” the shift key down for you. AppleScript doesn’t have a way to tell the keyboard to do something, it can just mimic what it does.

Hello Adam,

Thanks for your reply.

To be specific I need an AppleScript that will enable the Caps Lock in a way that can be detected by FileMaker’s Status(CurrentModifierKeys).

So it’s really not about caps or not, but about the state of the Caps Lock button as detected by FileMaker.

I imagine it’s possible using some advanced AppleScript (be it System Events, some Unix script inside an AppleScript or a small xcode applet ran from an AppleScript).

There’s got to be a way…

I told my client that this was not going to be a problem on the Mac thanks to Apple Script (should’ve done my research first) and so we started by finding a way to do this in Windows thinking that it would be the hard part… now that we found a way to this in Windows I hope I can make it work on Mac as well.

Help me save the day / my face ?

Cheers
cin