示例#1
0
 public void Perform()
 {
     if (type == "Key press")
     {
         VirtualKeyboard.PressKey(keys, keyModifier);
     }
     if (type == "Timer")
     {
         Thread.Sleep((int)(timer * 1000));
     }
 }
示例#2
0
        public void Perform()
        {
            switch (Type)
            {
            case "Key press":
                VirtualKeyboard.PressKey(Keys, KeyModifier);
                break;

            case "Timer":
                System.Threading.Thread.Sleep((int)(Timer * 1000));
                break;
            }
        }
        public static void PressKey(Keys key, Keys modifier)
        {
            uint keyCodeModifier  = (uint)modifier;
            uint scanCodeModifier = MapVirtualKey(keyCodeModifier, 0);

            VirtualKeyboard.SendKey(scanCodeModifier, KeyFlag.KeyDown | KeyFlag.Scancode);
            uint keyCode  = (uint)key;
            uint scanCode = MapVirtualKey(keyCode, 0);

            VirtualKeyboard.SendKey(scanCode, KeyFlag.KeyDown | KeyFlag.Scancode);
            System.Threading.Thread.Sleep((int)(100));
            VirtualKeyboard.SendKey(scanCode, KeyFlag.KeyUp | KeyFlag.Scancode);
            VirtualKeyboard.SendKey(scanCodeModifier, KeyFlag.KeyUp | KeyFlag.Scancode);
        }
示例#4
0
        public void perform()
        {
            switch (type)
            {
            case "Key hold":
                VirtualKeyboard.HoldKey(keys, keyModifier);
                break;

            case "Key press":
                VirtualKeyboard.PressKey(keys, keyModifier, timer);
                break;

            case "Key release":
                VirtualKeyboard.ReleaseKey(keys, keyModifier);
                break;

            case "Timer":
                System.Threading.Thread.Sleep((int)(timer * 1000));
                break;
            }
        }