public override void DoBeforeNextExecute() { KeyboardDevice.GetCurrentState(ref KeyState); if (Wheelturn != 0) { setPressedStrategy.Add(Wheelturn < 0 ? (int)Mouse.WheelBwd : (int)Mouse.WheelFwd); Wheelturn = Wheelturn - Math.Sign(Wheelturn); } if (Tempo != null && Tempo[0].GetLapse() >= Tempo[1]) { Tempo[0] = StopTimer(); Tempo = null; foreach (var code in Codes.Reverse()) { KeyOrButtonUp(code); } Codes = null; } setPressedStrategy.Do(); CheckScriptTimer(); if ((cmd == 'I') && setPressedStrategy.IsListEmpty()) { if (SF == null) { SF = new ScriptKeyboardAndMouse(this); } SF.KeyboardAndMouse(); } // If a mouse command was given in the script, issue it all at once right here if ((int)deltaXOut != 0 || (int)deltaYOut != 0 || wheel != 0) { var input = new MouseKeyIO.INPUT[1]; input[0].type = MouseKeyIO.INPUT_MOUSE; input[0].mi = MouseInput((int)deltaXOut, (int)deltaYOut, (uint)wheel, 0, MouseKeyIO.MOUSEEVENTF_MOVE | MouseKeyIO.MOUSEEVENTF_WHEEL); MouseKeyIO.NativeMethods.SendInput(1, input, Marshal.SizeOf(input[0].GetType())); // Reset the mouse values if ((int)deltaXOut != 0) { deltaXOut = deltaXOut - (int)deltaXOut; } if ((int)deltaYOut != 0) { deltaYOut = deltaYOut - (int)deltaYOut; } wheel = 0; } currentMouseState = null; // flush the mouse state }
public override void DoBeforeNextExecute() { if (Wheelturn != 0) { setPressedStrategy.Add(Wheelturn < 0 ? (int)Mouse.WheelBwd : (int)Mouse.WheelFwd); Wheelturn -= Math.Sign(Wheelturn); } if (Tempo != null && Tempo[0].GetLapse() >= Tempo[1]) { Tempo[0] = StopTimer(); Tempo = null; foreach (var code in Codes.Reverse()) { KeyOrButtonUp(code); } Codes = null; } setPressedStrategy.Do(); CheckScriptTimer(); KeysPressed.Clear(); for (int i = 1; i < 238; i++) { if (IsDown(i)) { KeysPressed.Add(i); } } if ((WheelValue = (IsDown((int)Mouse.WheelFwd) ? 1 : 0) + (IsDown((int)Mouse.WheelBwd) ? -1 : 0)) != 0) { setBit((int)(WheelValue < 0 ? Mouse.WheelBwd : Mouse.WheelFwd), false); } if (cmd == 'H') { if (SF == null) { SF = new ScriptHook(this); } SF.Hook(); } }
public void PressAndRelease(int button) { setButtonPressedStrategy.Add(button); }
//----------------------------------------------------------------------- public void PressAndRelease(int keycode) { setKeyPressedStrategy.Add(keycode); }
public void SetPressed(int button) { setPressedStrategy.Add(button); }
public void PressAndRelease(int button) => setPressedStrategy.Add(button);
public void PressAndRelease(int keycode) => setPressedStrategy.Add(keycode);
public void PressAndRelease(int button, int duration = -1) => setPressedStrategy.Add(button, duration);