Script for Caps Lock state

I’m attempting to get a script to read the status of the caps lock LED. The module that I need to import is ctypes however the function I need in cytpes is windll. It apparently doesn’t exist in the jython distribution.
Has anyone solved this from a different angle? Any help is appreciated.

Ignition 7.8
Win 7, win10

import java.awt.Toolkit
import java.awt.event.KeyEvent
isOn = java.awt.Toolkit.getDefaultToolkit().getLockingKeyState(java.awt.event.KeyEvent.VK_CAPS_LOCK)
print isOn
1 Like

Would there be a way to bind the isOn to an expression tag? (enabled property of a text display label)

Ignition 7.9
Win 10

Never mind. I just put the above script into a Client Event Script. In this case, the script would write to a memory tag instead of printing to console. From here, I could bind the tag to the enabled property.

1 Like