public AutoItController()
 {
     au3 = new AutoItX3();                              //initialize our au3 class library
     au3.AutoItSetOption("WinTitleMatchMode", 2);                        //advanced window matching
     hWnd = "";                                                   //let's use a window handle
     writeAfterRead = true;
 }
Пример #2
0
        private void BStart_Click(object sender, EventArgs e)
        {
            Autobot1.AutoItSetOption("CaretCoordMode", 2);
            Autobot1.AutoItSetOption("MouseCoordMode", 2);
            Autobot1.AutoItSetOption("PixelCoordMode", 2);

            Programe = TName.Text;

            Autobot1.WinGetHandle(Programe);
            Autobot1.WinActivate(Programe);

            Console.WriteLine(EzSearch(544, 234, 8, 0xF57E29, 4));


            // if (Autobot1.WinActive(Programe) == 1)
            //{
            LStatus1.Text = Programe + " ทำงาน !!";
            Autobot1.WinMove(Programe, "", 0, 0, 680, 480);

            Console.WriteLine("เริ่มเเล้วนะ");

            if (!BGWorker1.IsBusy)
            {
                BGWorker1.RunWorkerAsync();
            }

            LB2.Text = "เริ่มเเล้วนะ !!";
            // }
        }
Пример #3
0
        //AutoIT implementation to upload WorkSamples file which is not supported by Selenium
        public void UploadFileByAutoIT()
        {
            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinWaitActive("Open", "", 60);
            autoIt.AutoItSetOption("SendKeyDelay", 10);
            autoIt.Send(Base.uploadFile);
            autoIt.AutoItSetOption("SendKeyDelay", 10);
            autoIt.Send("{ENTER}");
        }
Пример #4
0
        private void btn_start_Click(object sender, RoutedEventArgs e)
        {
            Au3.AutoItSetOption("CaretCoordMode", 2);
            Au3.AutoItSetOption("MouseCoordMode", 2);
            Au3.AutoItSetOption("PixelCoordMode", 2);

            Au3.WinGetHandle(noxname);
            Au3.WinActivate(noxname);

            if (Au3.WinActive(noxname) == 1)
            {
                lbl_status.Content = "nox is active";

                if (!worker.IsBusy)
                {
                    isStart = true;
                    worker.RunWorkerAsync();
                }
            }
        }
        /// <summary>
        /// The entry point, or main thread / main loop, of our program
        /// </summary>
        public static void test()
        {
            au3 = new AutoItX3();                              //initialize our au3 class library

            au3.AutoItSetOption("WinTitleMatchMode", 4);                        //advanced window matching

            thread = new Thread(new ThreadStart(threadtest));                   //initialize and start our thread
            thread.Start();

            if (au3.WinExists("Névtelen - Jegyzettömb", "") == 0)                   //if an Untitled - Notepad document doesn't exist
                au3.Run(@"C:\WINDOWS\SYSTEM32\notepad.exe", "", au3.SW_SHOW);   //run notepad
            else
                au3.WinActivate("Névtelen - Jegyzettömb", "");                      //otherwise activate the window

            string hWnd = "";                                                   //let's use a window handle

            while (hWnd.Length == 0)                                            //try to get a handle to notepad until it succeeds
                hWnd = au3.WinGetHandle("Névtelen - Jegyzettömb", "");

            while (au3.WinActive("handle=" + hWnd, "") == 0)                    //loop while it's not active
            {
                au3.WinActivate("handle=" + hWnd, "");                          //and activate it
                Thread.Sleep(100);
            }

            while (au3.WinExists("handle=" + hWnd, "") != 0)                    //while the window exists, loop
            {
                //send our incrementing variable, i, to notepad, with a trailing |
                au3.ControlSend("handle=" + hWnd, "", "Edit1", i.ToString() + "|", 0);

                i++;                                                            //increment i

                Thread.Sleep(100);                                              //short sleep so we don't burn CPU
            }

            //if the while loop exited--because there's no Untitled - Notepad--make the other thread stop executing
            threadshouldexecute = false;

            Console.Write("Press [ENTER] to continue...");                      //tell the user to press ENTER to quit
            Console.ReadLine();                                                 //pause until enter is pressed
        }
Пример #6
0
        public Form1()
        {
            InitializeComponent();

            //Load state
            var appSettings = ConfigurationManager.AppSettings;

            if (appSettings.Count != 0)
            {
                pressSpell1Interval = Convert.ToInt32(appSettings["pressSpell1Interval"]);
                pressSpell2Interval = Convert.ToInt32(appSettings["pressSpell2Interval"]);
                pressSpell3Interval = Convert.ToInt32(appSettings["pressSpell3Interval"]);
                pressSpell4Interval = Convert.ToInt32(appSettings["pressSpell4Interval"]);
                pressActiveInterval = Convert.ToInt32(appSettings["pressActiveInterval"]);
                autoKeyOnBool       = Convert.ToBoolean(appSettings["autoKeyOnBool"]);
                active1OnBool       = Convert.ToBoolean(appSettings["active1OnBool"]);
                active2OnBool       = Convert.ToBoolean(appSettings["active2OnBool"]);
                active3OnBool       = Convert.ToBoolean(appSettings["active3OnBool"]);
                active5OnBool       = Convert.ToBoolean(appSettings["active5OnBool"]);
                active6OnBool       = Convert.ToBoolean(appSettings["active6OnBool"]);
                active7OnBool       = Convert.ToBoolean(appSettings["active7OnBool"]);
                wardOnBool          = Convert.ToBoolean(appSettings["wardOnBool"]);
                wardHopOn           = Convert.ToBoolean(appSettings["wardHopOn"]);
                qPreactivateW       = Convert.ToBoolean(appSettings["qPreactivateW"]);
                qPreactivateE       = Convert.ToBoolean(appSettings["qPreactivateE"]);
                qPreactivateR       = Convert.ToBoolean(appSettings["qPreactivateR"]);
                wPreactivateQ       = Convert.ToBoolean(appSettings["wPreactivateQ"]);
                wPreactivateE       = Convert.ToBoolean(appSettings["wPreactivateE"]);
                wPreactivateR       = Convert.ToBoolean(appSettings["wPreactivateR"]);
                ePreactivateQ       = Convert.ToBoolean(appSettings["ePreactivateQ"]);
                ePreactivateW       = Convert.ToBoolean(appSettings["ePreactivateW"]);
                ePreactivateR       = Convert.ToBoolean(appSettings["ePreactivateR"]);
                rPreactivateQ       = Convert.ToBoolean(appSettings["rPreactivateQ"]);
                rPreactivateW       = Convert.ToBoolean(appSettings["rPreactivateW"]);
                rPreactivateE       = Convert.ToBoolean(appSettings["rPreactivateE"]);
                wardHopKey          = Convert.ToChar(appSettings["wardHopKey"]);
                activeKey           = Convert.ToChar(appSettings["activeKey"]);
            }
            qValueText.Text            = pressSpell1Interval.ToString();
            wValueText.Text            = pressSpell2Interval.ToString();
            eValueText.Text            = pressSpell3Interval.ToString();
            rValueText.Text            = pressSpell4Interval.ToString();
            activeValueText.Text       = pressActiveInterval.ToString();
            autoKeyOn.Checked          = autoKeyOnBool;
            active1On.Checked          = active1OnBool;
            active2On.Checked          = active2OnBool;
            active3On.Checked          = active3OnBool;
            active5On.Checked          = active5OnBool;
            active6On.Checked          = active6OnBool;
            active7On.Checked          = active7OnBool;
            wardCheckbox.Checked       = wardOnBool;
            wardHopCheckBox.Checked    = wardHopOn;
            qActivateWCheckBox.Checked = qPreactivateW;
            qActivateECheckBox.Checked = qPreactivateE;
            qActivateRCheckBox.Checked = qPreactivateR;
            wActivateQCheckBox.Checked = wPreactivateQ;
            wActivateECheckBox.Checked = wPreactivateE;
            wActivateRCheckBox.Checked = wPreactivateR;
            eActivateQCheckBox.Checked = ePreactivateQ;
            eActivateWCheckBox.Checked = ePreactivateW;
            eActivateRCheckBox.Checked = ePreactivateR;
            rActivateQCheckBox.Checked = rPreactivateQ;
            rActivateWCheckBox.Checked = rPreactivateW;
            rActivateECheckBox.Checked = rPreactivateE;
            wardHopKeyComboBox.Text    = wardHopKey.ToString();
            activeKeyComboBox.Text     = activeKey.ToString();
            //End load state



            HookManager.KeyDown += HookManager_KeyDown;
            HookManager.KeyUp   += HookManager_KeyUp;

            // The requested resolution in 100 ns units:
            int DesiredResolution = 1000;
            // Note: The supported resolutions can be obtained by a call to NtQueryTimerResolution()

            int CurrentResolution = 0;

            // 1. Requesting a higher resolution
            // Note: This call is similar to timeBeginPeriod.
            // However, it to to specify the resolution in 100 ns units.
            if (NtSetTimerResolution(DesiredResolution, true, out CurrentResolution) != 0)
            {
                Console.WriteLine("Setting resolution failed");
            }
            else
            {
                Console.WriteLine("CurrentResolution [100 ns units]: " + CurrentResolution);
            }

            ATimer.ElapsedTimerDelegate callback = timer_Tick;
            timer = new ATimer(3, 1, callback);
            timer.Start();

            activeKeyComboBox.Text  = "E";
            wardHopKeyComboBox.Text = "Q";

            _autoIT.AutoItSetOption("SendKeyDelay", 0);
            _autoIT1.AutoItSetOption("SendKeyDelay", 0);
            _autoIT2.AutoItSetOption("SendKeyDelay", 0);
            _autoIT3.AutoItSetOption("SendKeyDelay", 0);
            _autoIT4.AutoItSetOption("SendKeyDelay", 0);

            _autoIT.AutoItSetOption("SendKeyDownDelay", 0);
            _autoIT1.AutoItSetOption("SendKeyDownDelay", 0);
            _autoIT2.AutoItSetOption("SendKeyDownDelay", 0);
            _autoIT3.AutoItSetOption("SendKeyDownDelay", 0);
            _autoIT4.AutoItSetOption("SendKeyDownDelay", 0);
        }