Beispiel #1
0
        private void ProcessOnOff(string key, bool isOn, string token)
        {
            Keys eKey = LookupNewKeyName(key);

            if (eKey != Keys.NumLock && eKey != Keys.CapsLock && eKey != Keys.Scroll)
            {
                throw new UserException(Strings.Item("KeyScript__InvalidOnOff").Replace("%0", token));
            }
            int state   = isOn ? 1 : 0;
            int current = Windows.GetKeyState((int)eKey) & 1;

            if (state != current)
            {
                AddCommand(Modes.Press, eKey);
            }
        }