예제 #1
0
파일: Input.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            string doc = settings["input"];
            string[] str = doc.Split('\\');
            string name = settings["app_name"];
            string[] parsed = settings["input_text"].Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            string title = str[str.Length - 1];

            au3.Opt("WinTitleMatchMode", 4);
            au3.WinActivate("[HANDLE:" + hWnd.handle + "]", "");

            au3.Opt("WinTitleMatchMode", 2);
            au3.Opt("SendKeyDelay", 20);

            Time.startTimer(name + ":" + settings["app_instance"], "input");

            foreach (string part in parsed)
            {
                au3.Send(part, 0);
                au3.Sleep(100);
                au3.Send("{ENTER}", 0);
                au3.Sleep(500);
            }

            Time.stopTimer(name + ":" + settings["app_instance"], "input");

            //hWnd.handle = au3.WinGetHandle(title, "");
            //hWnd.title = au3.WinGetTitle(title, "");
            return hWnd;
        }
예제 #2
0
파일: Run.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            string path = settings["app_path"];
            string[] str = path.Split('\\');
            string name = settings["app_name"];

            Process appProc = Process.Start(path,"");

            Time.startTimer(name, "launch to ready");
            Time.startTimer(name, "runtime");

            appProc.WaitForInputIdle();

            string handle = appProc.MainWindowHandle.ToString();

            au3.Opt("WinTitleMatchMode", 2);
            while (true)
            {
                au3.WinActivate("iTunes", "");
                if (au3.WinActive("iTunes", "").Equals(1)) { break; }
            }

            while (true)
            {
                au3.Send("^u", 0);
                au3.WinActivate("Open Stream", "");
                if (au3.WinActive("Open Stream", "").Equals(1)) { break; }
            }

            au3.Send("{ESC}",0);

            appProc.WaitForInputIdle();

            handle = au3.WinGetHandle("iTunes", "");

            Console.WriteLine("Passed WaitActive");

            Time.stopTimer(name, "launch to ready");
            hWnd.handle = handle;
            hWnd.myProc = appProc;
            return hWnd;
        }
예제 #3
0
파일: Open.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            string doc = settings["open"];
            string[] str = doc.Split('\\');
            string name = settings["app_name"] + ":" + settings["app_instance"];

            string title = str[str.Length - 1];

            au3.Opt("WinTitleMatchMode", 4);
            au3.WinActivate("[HANDLE:" + hWnd.handle + "]", "");

            au3.Opt("WinTitleMatchMode", 2);
            au3.Opt("SendKeyDelay", 20);
            au3.Send("^o", 0);
            while (true)
            {
                if (au3.WinExists("Open", "") != 0) { break; }
            }
            au3.Sleep(1000);
            au3.Send(doc, 0);
            au3.Send("{ENTER}", 0);

            Time.startTimer(name, "open");

            au3.Opt("WinTitleMatchMode", 2);

            while (true)
            {
                au3.WinActivate(title, "");
                if (au3.WinActive(title, "") != 0) { break; }
            }

            hWnd.myProc.WaitForInputIdle();

            Time.stopTimer(name, "open");
            hWnd.handle = au3.WinGetHandle(title, "");
            hWnd.title = au3.WinGetTitle(title, "");
            return hWnd;
        }
예제 #4
0
파일: Close.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();
            string name = settings["app_name"] + ":" + settings["app_instance"];

            au3.Opt("WinTitleMatchMode", 4);
            au3.WinActivate("[HANDLE:" + hWnd.handle + "]", "");
            au3.WinClose("[HANDLE:" + hWnd.handle + "]", "");
            hWnd.myProc.CloseMainWindow();
            Time.stopTimer(name, "runtime");
            return hWnd;
        }
예제 #5
0
파일: Zoom out.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            string name = settings["app_name"] + ":" + settings["app_instance"];
            au3.Opt("WinTitleMatchMode", 4);
            au3.WinActivate("[HANDLE:" + hWnd.handle + "]", "");

            au3.Send("^-",0);
            au3.Sleep(200);
            return hWnd;
        }
예제 #6
0
파일: Run.cs 프로젝트: cquinlan/USBT
 public bool checkKeystroke()
 {
     AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();
     au3.Send("^e", 0);
     while(true)
     {
         au3.WinActivate("All Displayed Items Chosen","");
         if (au3.WinActive("All Displayed Items Chosen", "").Equals(1))
         {
             au3.Send("{e up}{CTRLUP}", 0);
             au3.Send("{ESC 2}", 0);
             au3.WinClose("All Displayed Items Chosen", "");
             return true;
         }
     }
 }
예제 #7
0
파일: Close.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            au3.Opt("WinTitleMatchMode", 4);
            while (true)
            {
                au3.WinActivate("[HANDLE:" + hWnd.handle + "]", "");
                if (au3.WinActive("[HANDLE:" + hWnd.handle + "]", "").Equals(1)) { break; }
            }
            au3.WinClose("[HANDLE:" + hWnd.handle + "]", "");
            hWnd.myProc.CloseMainWindow();
            hWnd.myProc.Kill();
            Time.stopTimer("iTunes", "runtime");
            return hWnd;
        }
예제 #8
0
파일: Select.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            au3.Opt("WinTitleMatchMode", 4);
            au3.WinActivate("[HANDLE:" + hWnd.handle + "]", "");
            //SetForegroundWindow(Convert.ToInt32(hWnd.handle));

            //while (true)
            //{
            //    au3.WinActivate("[HANDLE:" + hWnd.handle + "]", "");
            //    if (au3.WinActive("[HANDLE:" + hWnd.handle + "]", "") != 0) { break; }
            //}

            hWnd.handle = au3.WinGetHandle("[ACTIVE]", "");
            //hWnd.title = au3.WinGetTitle(title, "");
            return hWnd;
        }
예제 #9
0
파일: Close.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            string name = settings["app_name"];

            //au3.Opt("WinTitleMatchMode", 4);
            au3.WinActivate(hWnd.handle, "");
            au3.WinWaitActive(hWnd.handle, "", 5);
            au3.WinClose(hWnd.handle, "");
            au3.WinWaitClose(hWnd.handle, "", 5);
            if (!hWnd.myProc.HasExited)
            {
                hWnd.myProc.CloseMainWindow();
                hWnd.myProc.Kill();
            }
            Time.stopTimer(name, "runtime");
            return hWnd;
        }
예제 #10
0
파일: Close.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            string name = settings["app_name"] + ":" + settings["app_instance"];

            au3.Opt("WinTitleMatchMode", 4);
            au3.WinActivate("[HANDLE:" + hWnd.handle + "]", "");

            ps.ApplicationClass app = new ps.ApplicationClass();
            while (app.Documents.Count > 0)
            {
                app.ActiveDocument.Close(ps.PsSaveOptions.psDoNotSaveChanges);
            }
            app.Quit();

            if (!hWnd.myProc.HasExited)
            {
                hWnd.myProc.CloseMainWindow();
                hWnd.myProc.Close();
            }
            Time.stopTimer(name, "runtime");
            return hWnd;
        }
예제 #11
0
파일: Run.cs 프로젝트: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();
            au3.Opt("WinTitleMatchMode", 2);

            string path = settings["app_path"];
            string name = settings["app_name"];
            string[] str = path.Split('\\');

            Process appProc = Process.Start(path,"");

            Time.startTimer(name, "launch to ready");
            Time.startTimer(name, "runtime");

            appProc.WaitForInputIdle();

            while (true)
            {
                if (au3.WinActive("Organizer", "").Equals(1)) { break; }
            }

            au3.WinActivate("Organizer", "");

            checkKeystroke();
            string handle = appProc.MainWindowHandle.ToString();

            Time.stopTimer(name, "launch to ready");

            hWnd.handle = handle;
            hWnd.myProc = appProc;
            return hWnd;
        }
예제 #12
0
        private void install(string type)
        {
            UpdateDes.Text = "正在准备安装最新的病毒库...";
            au3 = new AutoItX3Lib.AutoItX3Class();								//initialize our au3 class library
            //au3.AutoItSetOption("WinDetectHiddenText", 1);
            au3.AutoItSetOption("WinTitleMatchMode", 2);						//advanced window matching
            string sPath = Environment.CurrentDirectory + @"\360upd\";

            sPath = sPath + @"360sd-upd" + type + ver + ".exe";
            //MessageBox.Show(sPath);
            au3.Run(sPath, "", au3.SW_MINIMIZE);
            au3.WinWaitActive("360杀毒");
            string title = au3.WinGetTitle("360杀毒");
            string text = au3.ControlGetText("360杀毒", "", "[CLASS:Static; INSTANCE:1]");
            if (text.Equals("在您的机器中发现未安装360杀毒, 请先安装360杀毒!"))
            {
                UpdateDes.Text = text;
                au3.Send("{ENTER}");
                downloadSd();
                installSd();
                install("");
                return;
                //downloadFile("-savapi-full");
                //install("-savapi-full");
            }
             text  = au3.ControlGetText("360杀毒", "", "[CLASS:Static]");

            if (text.Equals("您安装的是迷你版360杀毒, 请下载病毒库完整安装包!"))
            {
                UpdateDes.Text = "您安装的是迷你版360杀毒, 系统需要下载完整安装包!";
                au3.Send("{ENTER}");

                downloadFile("-savapi-full");
                install("-savapi-full");
            }

            if (title.Equals("360杀毒提示"))
            {

                text = au3.ControlGetText("360杀毒提示", "", "[CLASS:Static; INSTANCE:2]");
                //MessageBox.Show(text);
                if (text.Equals("即将关闭正在运行的360杀毒,您确认要立即更新吗?"))
                au3.Send("!y");
                au3.WinWaitActive("360杀毒", "已成功完成病毒库更新");
                au3.WinActivate("360杀毒", "已成功完成病毒库更新");
                au3.Send("!l");
            }
        }