示例#1
0
        private static void ClickControl(AutomationElement control)
        {

            try
            {
                AutoItX3Lib.AutoItX3 at = new AutoItX3Lib.AutoItX3();

                System.Windows.Point clickpoint1 = control.GetClickablePoint();
                Console.WriteLine("Got clickable Points ");
                double x = clickpoint1.X;
                double y = clickpoint1.Y;
                int x1 = Convert.ToInt32(x);
                int y1 = Convert.ToInt32(y);

                at.MouseMove(x1, y1, -1);
                try
                {
                    at.MouseClick("LEFT", x1, y1, 1);

                }
                catch (Exception e)
                {
                    throw new Exception(e.Message);
                }

            }
            catch (Exception ex)
            {

                throw new Exception("error on getclickablepoints :" + ex.Message);

            }
        }