Ejemplo n.º 1
0
        //执行任务
        public void ExcuteTask(string applicationName, string url, int x, int y)
        {
            ProcessStartInfo ps = new ProcessStartInfo(applicationName, url);

            Process.Start(ps);
            Thread.Sleep(5000);
            MouseEvents.SetCursorPosition(x, y);
            MouseEvents.MouseOneClick();
        }
Ejemplo n.º 2
0
        public void ExcuteTask(TaskModel task)
        {
            int processID;
            ProcessStartInfo ps = new ProcessStartInfo(task.Application, task.Url);

            ps.WindowStyle = ProcessWindowStyle.Maximized;
            Process myProc = Process.Start(ps);

            processID = myProc.Id;
            Thread.Sleep((int)numericUpDown2.Value * BASENUM);
            //设置鼠标位置
            MouseEvents.SetCursorPosition(task.PositionX, task.PositionY);
            //模拟鼠标双击
            MouseEvents.MouseDbClick();
            Thread.Sleep(1000);

            KillProcess(task.Application);
            //Process.GetCurrentProcess().Kill();
            //myProc = Process.GetProcessById(processID);
            //myProc.Kill();
        }