Exemplo n.º 1
0
        private void ECFile_Click(object sender, EventArgs e)
        {
            //ImageScanner.ScreenCapture();
            // wait(1000);
            // Bitmap bitmain = new Bitmap(ScreenPath);
            // Bitmap bitsub = new Bitmap(@"E:\Documents\sub.png");

            // MessageBox.Show(ImageScanner.GetSubPositions(bitmain, bitsub)[0].ToString());
            //SendKeys.Send("This is a test...");
            //MessageBox.Show(Path.GetDirectoryName(Application.ExecutablePath));
            int    j          = 0;
            string ScreenPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\folder1\Screenshot.PNG";
            Bitmap bitmain    = new Bitmap(ScreenPath);
            Bitmap bitsub     = new Bitmap(@"C:\Users\junxi\source\repos\AutoClicker\AutoClicker\bin\Debug\img\sub.PNG");
            bool   isEmpty    = !ImageScanner.GetSubPositions(bitmain, bitsub).Any();

            while (isEmpty && j < 10)
            {
                j += 1;
                ImageScanner.ScreenCapture();
                wait(2000);
                //ScreenPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Screenshot.png";
            }
            MessageBox.Show("found");
        }
Exemplo n.º 2
0
        public void Reader(string item)
        {
            Point p = new Point();

            string[] itemList = item.Split(':');

            if (item.Contains("lclick"))
            {
                p.X = Int32.Parse(itemList[1]);
                p.Y = Int32.Parse(itemList[2]);

                c.LeftClick(p);
            }
            else if (item.Contains("rclick"))
            {
                p.X = Int32.Parse(itemList[1]);
                p.Y = Int32.Parse(itemList[2]);

                c.RightClick(p);
            }
            else if (item.Contains("copy"))
            {
                SendKeys.Send("^c");
            }
            else if (item.Contains("moveto"))
            {
                MoveTo.SetCursorPosition(Int32.Parse(itemList[1]), Int32.Parse(itemList[2]));
            }
            else if (item.Contains("timewait"))
            {
                wait(Int32.Parse(itemList[1]));
            }
            else if (item.Contains("sclick"))
            {
                k.ShiftDown();
                wait(500);
                p.X = Int32.Parse(itemList[1]);
                p.Y = Int32.Parse(itemList[2]);
                c.LeftClick(p);
                wait(500);
                k.ShiftUp();
            }
            else if (item.Contains("imgwait"))
            {
                int    j          = 0;
                string ScreenPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Screenshot.png";
                Bitmap bitmain    = new Bitmap(ScreenPath);
                Bitmap bitsub     = new Bitmap(Char.ToString(item[1]));

                while (!ImageScanner.GetSubPositions(bitmain, bitsub).Any() || j < 20)
                {
                    wait(1000);
                    j += 1;
                    ImageScanner.ScreenCapture();
                }
            }
        }
Exemplo n.º 3
0
 private void ScreenCap_Click(object sender, EventArgs e)
 {
     ImageScanner.ScreenCapture();
     MessageBox.Show("Screen Capture at: " + ScreenPath);
 }