예제 #1
0
        public static void ControlSearch()
        {
            KeyUnReg();
            OptionKeyUnReg();
            string ModuleName = MagicKeys.InputTextBox("Enter sub string for calling module", "ControlSearch");

            if (ModuleName == "0")
            {
                OptionKeyReg();
                return;
            }
            Module = ModuleName;
            MagicKeys.SetWindowPos(MagicKeys.GetForegroundWindow(), 0, 10, 10, 0, 0, MKC.SWP_NOSIZE | MKC.SWP_NOACTIVATE | MKC.SWP_NOZORDER);
            P = GetPluginCoord();
            if (P[0] == 1)
            {
                MagicKeys.Speak("Module found");
                MagicKeys.MouseMove(P[1], P[2], 0);
                KeyReg();
                OptionKeyReg();
                MagicKeys.SoundPlay("WindowOpened", 0);
                Directory.CreateDirectory(@".\DevSave\" + Module);
                ModuleFound();
                KeyUnReg();
                MagicKeys.SoundPlay("WindowClosed", 0);
            }
            else
            {
                MagicKeys.Speak("Not found");
                OptionKeyReg();
            }
        }
예제 #2
0
        public static void MouseMover(string To)
        {
            OCRR = string.Empty;
            Thread.Sleep(20);
            KeyUnReg();
            int[] MP = MagicKeys.GetMousePosition();
            if (To == "Left")
            {
                if (MP[0] - MouseStep <= P[1])
                {
                    MagicKeys.SoundPlay("End", 0);
                    MagicKeys.MouseMove(P[1], MP[1], 0);
                    KeyReg();
                    return;
                }
                MagicKeys.MouseMove(MP[0] - MouseStep, MP[1], 0);
            }

            if (To == "Right")
            {
                if (MP[0] + MouseStep >= P[3])
                {
                    MagicKeys.SoundPlay("End", 0);
                    MagicKeys.MouseMove(P[3], MP[1], 0);
                    KeyReg();
                    return;
                }
                MagicKeys.MouseMove(MP[0] + MouseStep, MP[1], 0);
            }

            if (To == "Up")
            {
                if (MP[1] - MouseStep <= P[2])
                {
                    MagicKeys.SoundPlay("End", 0);
                    MagicKeys.MouseMove(MP[0], P[2], 0);
                    KeyReg();
                    return;
                }
                MagicKeys.MouseMove(MP[0], MP[1] - MouseStep, 0);
            }

            if (To == "Down")
            {
                if (MP[1] + MouseStep >= P[4])
                {
                    MagicKeys.SoundPlay("End", 0);
                    MagicKeys.MouseMove(MP[0], P[4], 0);
                    KeyReg();
                    return;
                }
                MagicKeys.MouseMove(MP[0], MP[1] + MouseStep, 0);
            }
            if (AutoOCR == 1)
            {
                VisionBot();
            }
            KeyReg();
        }
예제 #3
0
 public static void OCRClick(string BTN)
 {
     if (DP[0] == 0)
     {
         MagicKeys.Speak(T._("No rectangle for OCR"));
         return;
     }
     int[] MP = MagicKeys.GetMousePosition();
     MagicKeys.MouseClick(BTN, MP[0] + (DP[0] / 2), MP[1] + (DP[1] / 2), 1, 0, 0, 10);
     MagicKeys.MouseMove(MP[0], MP[1], 1);
 }
예제 #4
0
        public static void MouseGoTo()
        {
            KeyUnReg();
            OptionKeyUnReg();
            int[]    MP = MagicKeys.GetMousePosition();
            InputBox X  = new InputBox();

            X.Text = "Mouse X";
            X.InputBoxLabel.Text = "Enter new mouse position X";
            X.Value.Minimum      = 0;
            X.Value.Maximum      = P[3] - P[1];
            X.ShowDialog();
            int NewX;

            if (X.DialogResult == DialogResult.OK)
            {
                NewX = Convert.ToInt32(X.GetString());
            }
            else
            {
                KeyReg();
                OptionKeyReg();
                return;
            }
            InputBox Y = new InputBox();

            Y.Text = "Mouse Y";
            Y.InputBoxLabel.Text = "Enter new mouse position Y";
            Y.Value.Minimum      = 0;
            Y.Value.Maximum      = P[4] - P[2];
            Y.ShowDialog();
            int NewY;

            if (Y.DialogResult == DialogResult.OK)
            {
                NewY = Convert.ToInt32(Y.GetString());
            }
            else
            {
                KeyReg();
                OptionKeyReg();
                return;
            }
            MagicKeys.MouseMove(P[1] + NewX, P[2] + NewY, 0);
            KeyReg();
            OptionKeyReg();
        }
예제 #5
0
        public static async void OCRWordPosition()
        {
            KeyUnReg();
            OptionKeyUnReg();
            Bitmap   Screen = new Bitmap(P[3] - P[1], P[4] - P[2]);
            Graphics g      = Graphics.FromImage(Screen);

            g.CopyFromScreen(P[1], P[2], 00, 0, Screen.Size);
            var engine       = Windows.Media.Ocr.OcrEngine.TryCreateFromLanguage(new Windows.Globalization.Language("en"));
            var memoryStream = new MemoryStream();

            Screen.Save(memoryStream, ImageFormat.Bmp);
            var WMS     = WindowsRuntimeStreamExtensions.AsRandomAccessStream(memoryStream);
            var decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(WMS);

            var softwareBitmap = await decoder.GetSoftwareBitmapAsync();

            var OCRR = await engine.RecognizeAsync(softwareBitmap);

            OCRResultForm ORF = new         OCRResultForm();

            foreach (var Line in OCRR.Lines)
            {
                for (int I = 0; I <= Line.Words.Count - 1; I++)
                {
                    LW.Add(Line.Words[I].Text);
                    LX.Add(Convert.ToInt32(Line.Words[I].BoundingRect.X));
                    LY.Add(Convert.ToInt32(Line.Words[I].BoundingRect.Y));
                }
            }
            foreach (var W in LW)
            {
                ORF.WList.Items.Add(W);
            }
            ORF.ShowDialog();
            if (ORF.DialogResult == DialogResult.OK)
            {
                int SI = ORF.WList.SelectedIndex;
                MagicKeys.MouseMove(P[1] + LX[SI], P[2] + LY[SI], 0);
                LW.Clear();
                LX.Clear();
                LY.Clear();
            }
            OptionKeyReg();
            KeyReg();
        }