private void detectBirdwatcher(Joint head, Joint rightHand, Joint rightElbow, Joint rightShoulder) { //Calculate how far our right hand is from head in both x and y directions double deltaX = Math.Abs(rightHand.Position.X - head.Position.X); double deltaY = Math.Abs(rightHand.Position.Y - head.Position.Y); double headelbowXDifferential = rightElbow.Position.X - head.Position.X; if (deltaY < 0.05 && rightHand.Position.Y > rightElbow.Position.Y && rightElbow.Position.Y > rightShoulder.Position.Y && deltaX < 0.3 && headelbowXDifferential > 0.2) { // Birdwatcher! InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_Y); // show augmented reality (twitter layer) } else { if (InputSimulator.IsKeyDown(VirtualKeyCode.VK_Y)) { InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_Y); } } }
/// <summary> /// Process arm turning. Currently set to fast turn speed only. /// </summary> /// <param name="shoulder"></param> /// <param name="rightHand"></param> /// <param name="rightElbow"></param> /// <param name="leftHand"></param> /// <param name="leftElbow"></param> /// <returns></returns> private Boolean detectArmTurning(Joint shoulder, Joint rightHand, Joint rightElbow, Joint leftHand, Joint leftElbow) { double diffHandShoulderRight = Math.Abs(rightHand.Position.Y - shoulder.Position.Y); double diffHandShoulderLeft = Math.Abs(leftHand.Position.Y - shoulder.Position.Y); // right hand if (diffHandShoulderRight < armTurnThresh && rightHand.Position.X > rightElbow.Position.X) { InputSimulator.SimulateKeyDown(VirtualKeyCode.OEM_PERIOD); return(true); } // left hand else if (diffHandShoulderLeft < armTurnThresh && leftHand.Position.X < leftElbow.Position.X) { InputSimulator.SimulateKeyDown(VirtualKeyCode.OEM_COMMA); return(true); } // neither right nor left hand else { if (InputSimulator.IsKeyDown(VirtualKeyCode.OEM_PERIOD)) { InputSimulator.SimulateKeyUp(VirtualKeyCode.OEM_PERIOD); } if (InputSimulator.IsKeyDown(VirtualKeyCode.OEM_COMMA)) { InputSimulator.SimulateKeyUp(VirtualKeyCode.OEM_COMMA); } return(false); } }
private void updateText(object sender, EventArgs e) { //Insert code here to emulate keypress into chrome textResult.AppendText(dataReceived + "\n"); switch (dataReceived) { case "Wd\r": InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_W); break; case "Wu\r": InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_W); break; case "Ad\r": InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_A); break; case "Au\r": InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_A); break; case "Dd\r": InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_D); break; case "Du\r": InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_D); break; } }
private void executarFinalizar() { this.esperar(); if (this.strMacro.ToLower().Contains(STR_KEY_CLICK_MIDDLE_DOWN)) { mouse_event(INT_MOUSE_EVENTF_MIDDLE_UP, (uint)Cursor.Position.X, (uint)Cursor.Position.Y, 0, 0); } if (this.strMacro.ToLower().Contains(STR_KEY_CLICK_RIGHT_DOWN)) { mouse_event(INT_MOUSE_EVENTF_RIGHT_UP, (uint)Cursor.Position.X, (uint)Cursor.Position.Y, 0, 0); } if (this.strMacro.ToLower().Contains(STR_KEY_SHIFT_DOWN)) { InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); } if (!this.booCancelar) { this.executarFinalizarBeep(); } Console.WriteLine(string.Format("Macro {0} {1}.", this.intNumTecla, this.booCancelar ? "cancelada" : "finalizada")); this.booCancelar = false; MacroManager.i.objMacroAtual = null; }
public static void PressCombo(VirtualKeyCode[] combo, int minHoldTime, int maxHoldTime, bool sendWithDirectX, Random r) { if (combo == null || combo.Length == 0) { Thread.Sleep(r.Next(minHoldTime, maxHoldTime)); } else { if (sendWithDirectX) { foreach (VirtualKeyCode key in combo) { SendDirectXKey(GetScanCode(key), (int)KeyFlag.ScanCode | (int)KeyFlag.KeyDown); } Thread.Sleep(r.Next(minHoldTime, maxHoldTime)); foreach (VirtualKeyCode key in combo) { SendDirectXKey(GetScanCode(key), (int)KeyFlag.ScanCode | (int)KeyFlag.KeyUp); } } else { foreach (VirtualKeyCode key in combo) { InputSimulator.SimulateKeyDown(key); } Thread.Sleep(r.Next(minHoldTime, maxHoldTime)); foreach (VirtualKeyCode key in combo) { InputSimulator.SimulateKeyUp(key); } } } }
/// <summary> /// Releases all the buttons. /// </summary> public void ReleaseAll() { foreach (VirtualKeyCode key in _inputResolver.InputMap.Values) { InputSimulator.SimulateKeyUp(key); } }
private static void fishTTCPunchlinePlace() { //Go to fisherman InputSimulator.SimulateKeyDown(VirtualKeyCode.DOWN); Thread.Sleep(2000); InputSimulator.SimulateKeyUp(VirtualKeyCode.DOWN); InputSimulator.SimulateKeyDown(VirtualKeyCode.RIGHT); Thread.Sleep(800); InputSimulator.SimulateKeyUp(VirtualKeyCode.RIGHT); InputSimulator.SimulateKeyDown(VirtualKeyCode.UP); Thread.Sleep(700); InputSimulator.SimulateKeyUp(VirtualKeyCode.UP); Thread.Sleep(2000); sellFish();//sell fish //Go back to dock InputSimulator.SimulateKeyDown(VirtualKeyCode.DOWN); Thread.Sleep(700); InputSimulator.SimulateKeyUp(VirtualKeyCode.DOWN); InputSimulator.SimulateKeyDown(VirtualKeyCode.LEFT); Thread.Sleep(750); InputSimulator.SimulateKeyUp(VirtualKeyCode.LEFT); InputSimulator.SimulateKeyDown(VirtualKeyCode.UP); Thread.Sleep(2000); InputSimulator.SimulateKeyUp(VirtualKeyCode.UP); }
public void SimulateKeyUp() { if (!_pressed) { return; } if (!FakeToggle) { _pressed = false; if (VirtualKey != Keys.NoName) { InputSimulator.SimulateKeyUp((VirtualKeyCode)VirtualKey); VirtualKeyUp?.Invoke(this, (VirtualKeyCode)VirtualKey); } else if (IsAltGrPressed) { InputSimulator.SimulateKeyUp(VirtualKeyCode.RMENU); InputSimulator.SimulateKeyUp(VirtualKeyCode.LCONTROL); } else { InputSimulator.SimulateKeyDown(VirtualKeyCode.LCONTROL); InputSimulator.SimulateKeyDown(VirtualKeyCode.RMENU); } } }
protected void Paste() { InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_V); InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_V); InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); }
//... private static void Main(string[] args) { String path = @"c:\temp\Password.txt"; String oPass = File.ReadAllText(path); //String ProcWindow = "Logon - Winman Live"; Process p = Process.Start(@"\\VS02\WinManV7\Live\WinMan.exe"); p.WaitForInputIdle(); IntPtr h = p.MainWindowHandle; while (p.MainWindowHandle == IntPtr.Zero) { System.Threading.Thread.Sleep(100); } if (Control.IsKeyLocked(Keys.CapsLock)) // Checks Capslock is on { InputSimulator.SimulateKeyDown(VirtualKeyCode.SHIFT); //ActivateApp("WinMan.exe"); ActivateApp("Winman"); //ActivateApp("Logon - Winman Live"); InputSimulator.SimulateTextEntry(oPass); InputSimulator.SimulateKeyUp(VirtualKeyCode.SHIFT); } else { //ActivateApp("WinMan.exe"); ActivateApp("Winman"); //ActivateApp("Logon - Winman Live"); InputSimulator.SimulateTextEntry(oPass); } InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN); }
public void Action(string action) { /* Esque Enter Rome Endi Peige daum Peige ãpi Tabi printi iscrim colar copiar recortar */ switch (action.ToLower()) { case "esque": InputSimulator.SimulateKeyPress(VirtualKeyCode.ESCAPE); break; case "enter": InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN); break; case "rome": InputSimulator.SimulateKeyPress(VirtualKeyCode.HOME); break; case "endi": InputSimulator.SimulateKeyPress(VirtualKeyCode.END); break; case "peige_daum": InputSimulator.SimulateKeyPress(VirtualKeyCode.NEXT); break; case "peige_ãpi": InputSimulator.SimulateKeyPress(VirtualKeyCode.PRIOR); break; case "tabi": InputSimulator.SimulateKeyPress(VirtualKeyCode.TAB); break; case "printi_iscrim": InputSimulator.SimulateKeyPress(VirtualKeyCode.SNAPSHOT); break; case "colar": InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_V); InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); break; case "copiar": InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_C); InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); break; case "recortar": InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X); InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); break; default: break; } }
// GOLF - Down the Hatch public static void downTheHatch()//yellow, needs fixed { BotFunctions.maximizeAndFocus(); Thread.Sleep(15000); InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); Thread.Sleep(2340); InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); }
public void VolumeUp_Spotify() { SwitchWindow_toSpotify(); InputSimulator.SimulateKeyDown(VirtualKeyCode.LCONTROL); InputSimulator.SimulateKeyPress(VirtualKeyCode.UP); Thread.Sleep(500); InputSimulator.SimulateKeyUp(VirtualKeyCode.LCONTROL); }
//GOLF - Swing-A-Long public static void swingALong() { BotFunctions.maximizeAndFocus(); Thread.Sleep(15000); InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); Thread.Sleep(2340);// 82% InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); }
private void executarMagia(VirtualKeyCode enmVirtualKeyCode) { InputSimulator.SimulateKeyDown(enmVirtualKeyCode); this.esperar(); InputSimulator.SimulateKeyUp(enmVirtualKeyCode); }
void FixedUpdate() { float ang = Mathf.Round(Front.transform.position.y - Rear.transform.position.y); if (sp.IsOpen) { try { string x = sp.ReadLine(); string[] inp = x.Split(','); float y = Mathf.Round(float.Parse(inp [0])); //speed nHandle = -float.Parse(inp [1]); //steering braking = float.Parse(inp [2]); //braking bpm = float.Parse(inp [3]); //pulse if ((nHandle != oHandle) && (Mathf.Abs(nHandle - oHandle) <= 20)) { Front.steerAngle = nHandle; oHandle = nHandle; } int s = (int)rb.velocity.magnitude * 18 / 5; rb.AddRelativeForce(Vector3.down * rb.velocity.magnitude); HUD.text = "Speed: " + s + " km/h\nBPM: " + bpm; Rear.motorTorque = y * speed; //to go forward if (braking > 200) { Rear.brakeTorque = braking + 6000; Rear.motorTorque = 0; InputSimulator.SimulateKeyDown(VirtualKeyCode.SPACE); } else { Rear.brakeTorque = 0; InputSimulator.SimulateKeyUp(VirtualKeyCode.SPACE); } print(y + "," + Front.steerAngle + "," + braking + "," + ang); if (Input.GetKey(KeyCode.A)) { sp.Write("u"); } if (Input.GetKey(KeyCode.Z)) { sp.Write("d"); } sp.BaseStream.Flush(); } catch (System.Exception) { } } if (Input.GetKey(KeyCode.Space)) { Rear.brakeTorque = braking; } }
// GOLF- Afternoon Tee public static void afternoonTee()//works, finished { BotFunctions.maximizeAndFocus(); Thread.Sleep(15000); toonLookAtHole(); Thread.Sleep(3000); InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); Thread.Sleep(2120); InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); }
// GOLF - Hole on the Range public static void holeOnTheRange()//needs fixed? Not sure { BotFunctions.maximizeAndFocus(); Thread.Sleep(15000); toonLookAtHole(); Thread.Sleep(3000); InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); Thread.Sleep(1800); // 68% InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); }
private static void fishDDLLullabyLane() { InputSimulator.SimulateKeyDown(VirtualKeyCode.UP); Thread.Sleep(4000); InputSimulator.SimulateKeyUp(VirtualKeyCode.UP); sellFish(); InputSimulator.SimulateKeyDown(VirtualKeyCode.DOWN); Thread.Sleep(6500); InputSimulator.SimulateKeyUp(VirtualKeyCode.DOWN); }
// GOLF - Seeing green public static void seeingGreen()//works, finished { BotFunctions.maximizeAndFocus(); Thread.Sleep(15000); toonLookAtHole(); Thread.Sleep(3000); InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); Thread.Sleep(1790); // 67% InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); }
//GOLF - Peanut Putter public static void peanutPutter() { BotFunctions.maximizeAndFocus(); Thread.Sleep(15000); toonLookAtHole(); Thread.Sleep(3000); InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); Thread.Sleep(1860); // 69-70% ? InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); }
//GOLF - Hot Links public static void hotLinks() { BotFunctions.maximizeAndFocus(); Thread.Sleep(15000); toonLookAtHole(); Thread.Sleep(3000); InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); Thread.Sleep(1800); // 67% InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL); }
/* * This method will send the key up event on all keys. It should be used when the program is closed to make sure * keys don't get stuck down. */ private void UpAllKeys() { InputSimulator.SimulateKeyUp(gasKey); InputSimulator.SimulateKeyUp(brakeKey); InputSimulator.SimulateKeyUp(clutchKey); gasDown = false; brakeDown = false; clutchDown = false; }
public static void sendKeyAvoidHook(string keys) { Hook.bSendKey += MultiKeyGesture.matchedKeys.Count + keys.Length * 2; foreach (var key in MultiKeyGesture.matchedKeys.Reverse()) { InputSimulator.SimulateKeyUp((VirtualKeyCode)key); } SendKeys.SendWait(keys); }
/* * This method is called when the user changes the clutch key textbox. It simply changes which key value is sent. */ public void SetClutchKey(WindowsInput.VirtualKeyCode newKey) { // Be sure to reset the key if it is down. if (clutchDown) { InputSimulator.SimulateKeyUp(clutchKey); clutchDown = false; } this.clutchKey = newKey; }
/* * This method is called when the user changes the gas key textbox. It simply changes which key value is sent. */ public void SetGasKey(WindowsInput.VirtualKeyCode newKey) { // Be sure to reset the key if it is down. if (gasDown) { InputSimulator.SimulateKeyUp(gasKey); gasDown = false; } this.gasKey = newKey; }
/* * This method is called when the user changes the brake key textbox. It simply changes which key value is sent. */ public void SetBrakeKey(WindowsInput.VirtualKeyCode newKey) { // Be sure to reset the key if it is down. if (brakeDown) { InputSimulator.SimulateKeyUp(brakeKey); brakeDown = false; } this.brakeKey = newKey; }
public static void Lift(VirtualKeyCode key, bool sendWithDirectX) { if (sendWithDirectX) { SendDirectXKey(GetScanCode(key), (int)KeyFlag.ScanCode | (int)KeyFlag.KeyUp); } else { InputSimulator.SimulateKeyUp(key); } }
public void NextMusicSpotify() { if (flag_spotifystart == true) { SwitchWindow_toSpotify(); InputSimulator.SimulateKeyDown(VirtualKeyCode.LCONTROL); InputSimulator.SimulateKeyPress(VirtualKeyCode.RIGHT); Thread.Sleep(1000); InputSimulator.SimulateKeyUp(VirtualKeyCode.LCONTROL); } }
public void SimulateKeyDown() { if (VirtualKey == Keys.LShiftKey) { Console.WriteLine("f1"); } if (!FakeToggle) { if (VirtualKey != Keys.NoName) { InputSimulator.SimulateKeyDown((VirtualKeyCode)VirtualKey); VirtualKeyDown?.Invoke(this, (VirtualKeyCode)VirtualKey); } else { InputSimulator.SimulateKeyDown(VirtualKeyCode.LCONTROL); InputSimulator.SimulateKeyDown(VirtualKeyCode.RMENU); } _pressed = true; } else { if (!Toggled) { Toggled = true; ButtonBackground = new SolidColorBrush(Color.FromArgb(120, 255, 255, 255)); if (VirtualKey != Keys.NoName) { InputSimulator.SimulateKeyDown((VirtualKeyCode)VirtualKey); VirtualKeyDown?.Invoke(this, (VirtualKeyCode)VirtualKey); } else { InputSimulator.SimulateKeyDown(VirtualKeyCode.LCONTROL); InputSimulator.SimulateKeyDown(VirtualKeyCode.RMENU); } } else { Toggled = false; ButtonBackground = Brushes.Transparent; if (VirtualKey != Keys.NoName) { InputSimulator.SimulateKeyUp((VirtualKeyCode)VirtualKey); VirtualKeyUp?.Invoke(this, (VirtualKeyCode)VirtualKey); } else { InputSimulator.SimulateKeyUp(VirtualKeyCode.RMENU); InputSimulator.SimulateKeyUp(VirtualKeyCode.LCONTROL); } } } }