Esempio n. 1
0
        public static void TypeText(MagickImage inputPlace, string text)
        {
            using (MagickImage screen = new MagickImage("screenshot:"))
            {
                using (inputPlace)
                {
                    try
                    {
                        if (ImageWorker.IsSubImageExist(screen, inputPlace))
                        {
                            MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(screen, inputPlace));
                            new InputSimulator().Keyboard.TextEntry(text);
                        }

                        else
                        {
                            throw new Exception("Such element not found");
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        throw;
                    }
                }
            }
        }
Esempio n. 2
0
        public static void TypeText(string screenPath, string inputPlaceImagePath, string text)
        {
            try
            {
                if (ImageWorker.IsSubImageExist(screenPath, inputPlaceImagePath))
                {
                    MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(screenPath, inputPlaceImagePath));
                    new InputSimulator().Keyboard.TextEntry(text);
                }

                else
                {
                    throw new Exception("Such element not found");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }