Пример #1
0
 /// <summary>
 /// Types text at the current cursor location
 /// </summary>
 /// <param name="text">the text to type</param>
 public void Type(string text)
 {
     keyboard.Sleep(500);
     keyboard.TextEntry(text);
 }
Пример #2
0
 private static void k(VirtualKeyCode key)
 {
     SetForegroundWindow(windowHandle);
     ksim.KeyPress(key);
     ksim.Sleep(DELAY_BETWWEN_KEYS);
 }
 private static void k(VirtualKeyCode key)
 {
     ksim.KeyPress(key);
     ksim.Sleep(150);
 }
Пример #4
0
        static void Main(string[] args)
        {
            string progPath = @"D:\0_User\Lukas\BWK\LED\USB Sequencer\Version 0.8\Windows 64\glo_ultimate_app.exe";

            Console.WriteLine("Starting Glo-Ultimate ...");
            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");
            windowHandle = p.MainWindowHandle;

            // Verify that Calculator is a running process.
            if (windowHandle == IntPtr.Zero)
            {
                Console.Error.WriteLine("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
            Console.WriteLine("Navigating to directory ...");
            k(VirtualKeyCode.F8);
            k(VirtualKeyCode.DOWN);
            k(VirtualKeyCode.RETURN);
            k(VirtualKeyCode.ESCAPE);

            for (int i = 0; i < 6; i++)
            {
                Console.WriteLine("Processing club #" + (i + 1) + " ...");
                k(VirtualKeyCode.F8);
                k(VirtualKeyCode.DOWN);
                k(VirtualKeyCode.RETURN);
                ksim.Sleep(DELAY_FOR_UPLOAD);
                k(VirtualKeyCode.DOWN);
            }

            Console.WriteLine("Press any key to start the program ...");
            Console.ReadKey(true);

            Console.WriteLine("Starting program ...");
            k(VirtualKeyCode.F12);
            k(VirtualKeyCode.F5);

            Console.WriteLine("Press any key to stop the program ...");
            Console.ReadKey(true);

            Console.WriteLine("Stopping program ...");
            k(VirtualKeyCode.F6);

            p.CloseMainWindow();

            Console.WriteLine("Done!");
        }
        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;
        }