示例#1
0
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

            ps.ApplicationClass app = new ps.ApplicationClass();

            app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes
            string[] dirFiles = Directory.GetFiles(doc); //Get a list of files in that directory
            Object[] supportedTypes = (Object[])app.WindowsFileTypes; //Get a list of supported types

            Time.startTimer(name, "openDir");

            foreach (string file in dirFiles)
            {
                string[] parse = file.Split('.');
                string ext = parse[parse.Length - 1];
                if (supportedTypes.Contains((Object)ext)) //Ensure the filetype is supported
                {
                    app.Application.Load(file);
                }
                else
                    Console.WriteLine("Could not load " + file + "\nType not supported");
            }
            //WaitForRedraw(app); //Pauses while Photoshop refreshes. Unsure if this works as desired.

            Time.stopTimer(name, "openDir");

            return hWnd;
        }
示例#2
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;
        }
示例#3
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"] + ":" + settings["app_instance"];

            Process appProc = Process.Start(path);

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

            while (true)
            {
                if (au3.WinExists("Welcome to Adobe Premiere Pro", "").Equals(1)) { break; }
            }

            string handle = appProc.MainWindowHandle.ToString("x");

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

            hWnd.handle = handle;
            hWnd.myProc = appProc;
            return hWnd;
        }
示例#4
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"] + ":" + settings["app_instance"];

            Process appProc = Process.Start(path);
            ps.ApplicationClass app = new ps.ApplicationClass();

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

            WaitForRedraw(app);
            while (true)
            {
                if (au3.WinExists("Adobe Photoshop", "").Equals(1)) { break; }
            }

            string handle = au3.WinGetHandle("Adobe Photoshop", "");

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

            hWnd.handle = handle;
            hWnd.myProc = appProc;
            return hWnd;
        }
示例#5
0
文件: Run.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            //This works well as a templet for winform and WPF apps. Needs to be changed when using any
            //specialty software i.e. Adobe apps and iTunes. Anything with it's own GUI system.

            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

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

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

            appProc.WaitForInputIdle();

            string handle = appProc.MainWindowHandle.ToString("x");

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

            hWnd.handle = handle;
            hWnd.myProc = appProc;
            return hWnd;
        }
示例#6
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;
        }
示例#7
0
文件: RunWith.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"] + ":" + settings["app_instance"];

            Process appProc = Process.Start(path,Path.GetFullPath(settings["open"]));

            Time.startTimer(name, "launch to ready");
            Time.startTimer(name, "runtime");
            StreamReader read = hWnd.myProc.StandardOutput;
            appProc.WaitForInputIdle();

            string handle = appProc.MainWindowHandle.ToString();

            while (true)
            {
                if (au3.WinExists("Adobe Reader", "").Equals(1) & hWnd.myProc.Responding) { break; }
            }

            appProc.WaitForInputIdle();

            Time.stopTimer(name, "launch to ready");
            hWnd.handle = handle;
            hWnd.myProc = appProc;
            Console.WriteLine(read.ReadToEnd());
            return hWnd;
        }
示例#8
0
文件: RunWith.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

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

            Process appProc = Process.Start(path, Path.GetFullPath(settings["open"]));
            Time.startTimer(name, "launch to ready");
            Time.startTimer(name, "runtime");

            au3.Opt("WinTitleMatchMode", 2);
            while (true)
            {
                if (au3.WinExists(title, "") != 0) { break; }
            }

            string handle = appProc.MainWindowHandle.ToString();

            Time.stopTimer(name, "launch to ready");
            hWnd.handle = handle;
            hWnd.myProc = appProc;
            return hWnd;
        }
示例#9
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", 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");

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

            Time.stopTimer(name, "open");
            return hWnd;
        }
示例#10
0
文件: Wait.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            au3.Sleep(Convert.ToInt32(settings["time"]));

            return hWnd;
        }
示例#11
0
文件: Minimize.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

            return hWnd;
        }
示例#12
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;
        }
示例#13
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;
        }
示例#14
0
文件: Action.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

            ps.ApplicationClass app = new ps.ApplicationClass();
            app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes
            Time.startTimer(name, "action " + act_name);
            app.DoAction(act_name, settings["action_set"]); //Do action of name act_name in the set given.
            Time.stopTimer(name, "action " + act_name);
            return hWnd;
        }
示例#15
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.WinClose("[HANDLE:" + hWnd.handle + "]", "");
            hWnd.myProc.CloseMainWindow();
            if (!hWnd.myProc.HasExited)
            {
                hWnd.myProc.Kill();
            }
            Time.stopTimer(name, "runtime");
            return hWnd;
        }
示例#16
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;
        }
示例#17
0
文件: SaveAs.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

            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("{F12}", 0);
            while (true)
            {
                if (au3.WinExists("Save As", "") != 0) { break; }
            }
            au3.Sleep(1000);
            au3.Send(doc, 0);
            au3.Send("{ENTER}", 0);

            if(au3.WinExists("[CLASS:bosa_sdm_Microsoft Office Word 12.0","").Equals(1))
            {
                au3.Send("{ENTER}", 0);
            }

            Time.startTimer(name , opName);

            au3.Opt("WinTitleMatchMode", 2);

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

            hWnd.myProc.WaitForInputIdle();

            Time.stopTimer(name , opName);
            hWnd.handle = au3.WinGetHandle(title, "");
            hWnd.title = au3.WinGetTitle(title, "");
            return hWnd;
        }
示例#18
0
文件: Open.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

            ps.ApplicationClass app = new ps.ApplicationClass();
            app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes
            app.Application.Load(doc);
            Time.startTimer(name, "open");

            WaitForRedraw(app); //Pauses while Photoshop refreshes. Unsure if this works as desired.

            Time.stopTimer(name, "open");
            return hWnd;
        }
示例#19
0
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

            ps.ApplicationClass app = new ps.ApplicationClass();
            app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes
            string[] arr = new string[0];
            Time.startTimer(name, "script");
            app.DoJavaScript(settings["input_text"],arr,1);
            WaitForRedraw(app); //Pauses while Photoshop refreshes. Unsure if this works as desired.
            Time.stopTimer(name, "script");

            return hWnd;
        }
示例#20
0
        public static void runTest(IOperation[] opList, Window[] windList, bool debug)
        {
            Time.startTimer("Test", "Total time"); //Our timer for the entire run.
            foreach (IOperation op in opList)
            {
                int i = 0;
                if(debug) //Beep to tell us when a new operation has started.
                    SystemSounds.Asterisk.Play();

                Window opWind = new Window();

                //Get the window to manipulate
                foreach (Window win in windList)
                {
                    if(win.name == op.settings["app_name"] && win.instance == Convert.ToInt32(op.settings["app_instance"]))
                    {
                        opWind = win;
                        break;
                    }
                    i++;
                }
                //Make something up if a Generic command.
                if (op.settings["app_name"] == "Generic")
                {
                    opWind = new Window();
                }

                //Use runOp from the IOperation interface. Return the window when done with it.
                if(debug)
                    Console.WriteLine("Starting " + op.settings["app_name"] + " - " + op.settings["op_name"]);

                Window returnValue = op.runOp(opWind);

                if(debug)
                    Console.WriteLine("(" + returnValue.name + " - " + returnValue.handle + ")\n");

                if (op.settings["app_name"] != "Generic")
                {
                    Window got = (Window)returnValue;
                    windList[i] = got;
                }
            }
            Time.stopTimer("Test", "Total time");
            //Done!
        }
示例#21
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;
        }
示例#22
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;
        }
示例#23
0
文件: Save.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

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

            ps.ApplicationClass app = new ps.ApplicationClass();
            ps.JPEGSaveOptionsClass options = new Photoshop.JPEGSaveOptionsClass();
            app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes

            //Save image as a jpg.
            app.Application.ActiveDocument.SaveAs(doc,options,true, ps.PsExtensionType.psUppercase);
            Time.startTimer(name, "save");

            WaitForRedraw(app); //Pauses while Photoshop refreshes. Unsure if this works as desired.

            Time.stopTimer(name, "save");
            return hWnd;
        }
示例#24
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"] + ":" + settings["app_instance"];

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

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

            appProc.WaitForInputIdle();
            string handle = appProc.MainWindowHandle.ToString("x");

            Time.stopTimer(name, "launch to ready");
            hWnd.handle = handle;
            hWnd.myProc = appProc;
            return hWnd;
        }
示例#25
0
文件: Control.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();
            iTunesLib.iTunesAppClass itunes = new iTunesLib.iTunesAppClass();

            string path = settings["app_path"];
            string name = settings["app_name"];
            string nput = settings["input_text"];

            switch (nput)
            {
                case "play":
                    itunes.Play();
                    break;
                case "pause":
                    itunes.Pause();
                    break;
                case "stop":
                    itunes.Stop();
                    break;
                case "toggle":
                    itunes.PlayPause();
                    break;
                case "forward":
                    itunes.NextTrack();
                    break;
                case "backward":
                    itunes.PreviousTrack();
                    break;
            }
            //Release the iTunes COM to avoid conflict when closing later
            Marshal.ReleaseComObject(itunes);

            //Set the object to null, leaving it marked for deletion by GC
            itunes = null;
            GC.Collect();

            return hWnd;
        }
示例#26
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;
        }
示例#27
0
        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);

            au3.Send(settings["input_text"], 0);

            hWnd.handle = au3.WinGetHandle("[ACTIVE]", "");
            hWnd.title = au3.WinGetTitle("[ACTIVE]", "");

            return hWnd;
        }
示例#28
0
文件: Pause.cs 项目: cquinlan/USBT
        public Window runOp(Window hWnd)
        {
            AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

            return hWnd;
        }