public void MouseWheel(string direction, int numClicks)
 {
     AutoItX.MouseWheel(direction, numClicks);
 }
Beispiel #2
0
        /// <summary>
        /// Выполнить макрос
        /// </summary>
        /// <param name="macros">Макрос</param>
        private void RunMacros(Macros macros)
        {
            foreach (Command command in macros)
            {
                //if (command.StrKey == "RightClick")
                //{
                //	if (command.SecondsPressed == 0)
                //	{
                //		AutoItX.MouseClick("RIGHT");
                //		Thread.Sleep(command.SecondsPausedAfter);
                //		Thread.Sleep(random.Next(command.PauseRandomMin,
                //			command.PauseRandomMax + 1));
                //	}
                //	else
                //	{
                //		MouseControler.RightHoldXSeconds(command.SecondsPressed);
                //		Thread.Sleep(command.SecondsPausedAfter);
                //		Thread.Sleep(random.Next(command.PauseRandomMin,
                //			command.PauseRandomMax + 1));
                //	}
                //}
                //else if (command.StrKey == "MouseMove")
                //{
                //	AutoItX.MouseMove(command.SecondsPressed, command.SecondsPausedAfter);
                //}
                //else if (command.StrKey == "LeftCick")
                //{
                //	if (command.SecondsPressed == 0)
                //	{
                //		AutoItX.MouseClick("LEFT");
                //		Thread.Sleep(command.SecondsPausedAfter);
                //		Thread.Sleep(random.Next(command.PauseRandomMin,
                //			command.PauseRandomMax + 1));
                //	}
                //	else
                //	{
                //		MouseControler.LeftHoldXSeconds(command.SecondsPressed);
                //		Thread.Sleep(command.SecondsPausedAfter);
                //		Thread.Sleep(random.Next(command.PauseRandomMin,
                //			command.PauseRandomMax + 1));
                //	}
                //}
                //else if (command.StrKey == "WheelUp")
                //{
                //	AutoItX.MouseWheel("up", random.Next(command.PressedRandomMin/ 100, command.PressedRandomMax/100));
                //	Thread.Sleep(command.SecondsPausedAfter);
                //	Thread.Sleep(random.Next(command.PauseRandomMin,
                //		command.PauseRandomMax + 1));
                //}
                //else if (command.StrKey == "WheelDown")
                //{
                //	AutoItX.MouseWheel("down", random.Next(command.PressedRandomMin / 100, command.PressedRandomMax / 100));
                //	Thread.Sleep(command.SecondsPausedAfter);
                //	Thread.Sleep(random.Next(command.PauseRandomMin,
                //		command.PauseRandomMax + 1));
                //}

                //ПКМ
                if (command.Key == 0x02)
                {
                    if (command.SecondsPressed == 0)
                    {
                        AutoItX.MouseClick("RIGHT");
                        Thread.Sleep(command.SecondsPausedAfter);
                        Thread.Sleep(random.Next(command.PauseRandomMin,
                                                 command.PauseRandomMax + 1));
                    }
                    else
                    {
                        MouseControler.RightHoldXSeconds(command.SecondsPressed);
                        Thread.Sleep(command.SecondsPausedAfter);
                        Thread.Sleep(random.Next(command.PauseRandomMin,
                                                 command.PauseRandomMax + 1));
                    }
                }
                //Двинуть мышь
                else if (command.Key == 0x03)
                {
                    AutoItX.MouseMove(command.SecondsPressed / 100, command.SecondsPausedAfter / 100, 50);
                }
                //ЛКМ
                else if (command.Key == 0x01)
                {
                    if (command.SecondsPressed == 0)
                    {
                        AutoItX.MouseClick("LEFT");
                        Thread.Sleep(command.SecondsPausedAfter / 100);
                        Thread.Sleep(random.Next(command.PauseRandomMin,
                                                 command.PauseRandomMax + 1));
                    }
                    else
                    {
                        MouseControler.LeftHoldXSeconds(command.SecondsPressed);
                        Thread.Sleep(command.SecondsPausedAfter);
                        Thread.Sleep(random.Next(command.PauseRandomMin,
                                                 command.PauseRandomMax + 1));
                    }
                }
                else if (command.StrKey == "WheelUp")
                {
                    AutoItX.MouseWheel("up", random.Next(command.PressedRandomMin / 100, command.PressedRandomMax / 100));
                    Thread.Sleep(command.SecondsPausedAfter);
                    Thread.Sleep(random.Next(command.PauseRandomMin,
                                             command.PauseRandomMax + 1));
                }
                else if (command.StrKey == "WheelDown")
                {
                    AutoItX.MouseWheel("down", random.Next(command.PressedRandomMin / 100, command.PressedRandomMax / 100));
                    Thread.Sleep(command.SecondsPausedAfter);
                    Thread.Sleep(random.Next(command.PauseRandomMin,
                                             command.PauseRandomMax + 1));
                }
                else
                {
                    keybd_event(command.Key /*клавиша*/, 1 /*???*/, KEYEVENTF_EXTENDEDKEY,
                                0);

                    Thread.Sleep(command.SecondsPressed);

                    Thread.Sleep(random.Next(command.PressedRandomMin,
                                             command.PressedRandomMax + 1));

                    keybd_event(command.Key /*клавиша*/, 1 /*???*/, KEYEVENTF_KEYUP, 0);

                    Thread.Sleep(command.SecondsPausedAfter);

                    Thread.Sleep(random.Next(command.PauseRandomMin,
                                             command.PauseRandomMax + 1));
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Созданный блок для автоматизации Уточнение сведений о ФЛ Отдел регистрации
 /// Пользовательские задания
 /// Ветка Физические лица/1.08. Сообщение ФЛ об объектах собственности\Уточнение сведений о ФЛ
 /// </summary>
 /// <param name="pathjurnalerror">Путь к журналу с ошибками</param>
 /// <param name="pathjurnalok">Путь к отработаным записям</param>
 /// <param name="usefilter">Переключатель если ложь делаем как обычно если правда то на вторую строку</param>
 public void Click2(string pathjurnalerror, string pathjurnalok, bool usefilter)
 {
     try
     {
         while (true)
         {
             WindowsAis3 win = new WindowsAis3();
             if (usefilter)
             {
                 win.ControlGetPos1(WindowsAis3.GridMain[0], WindowsAis3.GridMain[1], WindowsAis3.GridMain[2]);
                 AutoItX.MouseClick(ButtonConstant.MouseLeft, win.WindowsAis.X + win.X1 + 70, win.WindowsAis.Y + win.Y1 + 55, 2);
                 AutoItX.WinWait(WindowsAis3.Text, Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.TextFid, 30);
             }
             else
             {
                 win.ControlGetPos1(WindowsAis3.WinRequest[0], WindowsAis3.WinRequest[1], WindowsAis3.WinRequest[2]);
                 AutoItX.MouseClick(ButtonConstant.MouseLeft, win.WindowsAis.X + win.X1 + 355, win.WindowsAis.Y + win.Y1 + 80);
                 AutoItX.WinWait(WindowsAis3.Text, Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.TextFid, 30);
             }
             if (AutoItX.WinExists(WindowsAis3.Text, Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.TextFid) == 1)
             {
                 break;
             }
         }
         var fid = ReadWindow.Read.Reades.ReadForm(Mode.Reg.Yvedomlenie.Yvedomlenia.FidText);
         while (true)
         {
             AutoItX.ControlClick(WindowsAis3.Text, Mode.Reg.Yvedomlenie.Yvedomlenia.Visual[0], Mode.Reg.Yvedomlenie.Yvedomlenia.Visual[1], ButtonConstant.MouseLeft);
             AutoItX.WinWait(Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.VisualVindow, Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.UpdateText, 10);
             if (AutoItX.WinExists(Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.VisualVindow, Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.UpdateText) == 1)
             {
                 break;
             }
         }
         AutoItX.Sleep(2000);
         ClikcCheker.Cheker.Chekerfid();
         AutoItX.ControlClick(Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.VisualVindow, Mode.Reg.Yvedomlenie.Yvedomlenia.Update[0], Mode.Reg.Yvedomlenie.Yvedomlenia.Update[1], ButtonConstant.MouseLeft);
         while (true)
         {
             if (AutoItX.WinExists(Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.VisualVindow, WindowsAis3.DataNotFound) == 1)
             {
                 AutoItX.ControlClick(Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.VisualVindow, Mode.Reg.Yvedomlenie.Yvedomlenia.Select[0], Mode.Reg.Yvedomlenie.Yvedomlenia.Select[1], ButtonConstant.MouseLeft);
                 LibaryXMLAuto.ErrorJurnal.ErrorJurnal.JurnalError(pathjurnalerror, fid, ModeBranchUser, WindowsAis3.DataNotFound);
                 AutoItX.ControlClick(WindowsAis3.Text, Mode.Reg.Yvedomlenie.Yvedomlenia.Close[0], Mode.Reg.Yvedomlenie.Yvedomlenia.Close[1], ButtonConstant.MouseLeft);
                 break;
             }
             if (AutoItX.WinExists(Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.VisualVindow, Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.TextFidUser) == 1)
             {
                 AutoItX.ControlClick(Window.Otdel.Reg.Yvedomlenie.TextYvedomlenie.VisualVindow, Mode.Reg.Yvedomlenie.Yvedomlenia.Select[0], Mode.Reg.Yvedomlenie.Yvedomlenia.Select[1], ButtonConstant.MouseLeft);
                 AutoItX.MouseWheel(ButtonConstant.Wheel, 2);
                 AutoItX.ControlClick(WindowsAis3.Text, Mode.Reg.Yvedomlenie.Yvedomlenia.ComboboxSelect[0], Mode.Reg.Yvedomlenie.Yvedomlenia.ComboboxSelect[1], ButtonConstant.MouseLeft);
                 AutoItX.Send(ButtonConstant.Down2);
                 AutoItX.Send(ButtonConstant.Enter);
                 AutoItX.ControlClick(WindowsAis3.Text, Mode.Reg.Yvedomlenie.Yvedomlenia.Save[0], Mode.Reg.Yvedomlenie.Yvedomlenia.Save[1], ButtonConstant.MouseLeft);
                 AutoItX.Sleep(500);
                 AutoItX.Send(ButtonConstant.Enter);
                 AutoItX.ControlClick(WindowsAis3.Text, Mode.Reg.Yvedomlenie.Yvedomlenia.Close[0], Mode.Reg.Yvedomlenie.Yvedomlenia.Close[1], ButtonConstant.MouseLeft);
                 LibaryXMLAuto.ErrorJurnal.OkJurnal.JurnalOk(pathjurnalok, fid, "Отработали");
                 break;
             }
         }
     }
     catch (Exception e)
     {
         LibaryXMLAuto.ErrorJurnal.ErrorJurnal.JurnalError(pathjurnalerror, "Ошибка исключения надо смотреть!!!", ModeBranchUser, e.Message);
     }
 }