コード例 #1
0
ファイル: BeamProcess.cs プロジェクト: ramteju/Sample-Project
        public static void RunOCRonBluebeamtool(string folderpath)
        {
            try
            {
                ProcessHandlers.killapp("Revu");
                var psi = new ProcessStartInfo(ExeSourceFile);
                psi.UseShellExecute = true;
                _application        = TestStack.White.Application.AttachOrLaunch(psi);
                Process p = Process.GetProcessesByName("Revu").FirstOrDefault();
                while (p.MainWindowHandle == IntPtr.Zero)
                {
                    p.Refresh();
                }
                p.WaitForInputIdle();
                if (p != null)
                {
                    IntPtr h = p.MainWindowHandle;
                    ProcessHandlers.SetForegroundWindow(h);
                    p.WaitForInputIdle();
                    IntPtr hPRAZChem = ProcessHandlers.FindWindow(null, "Bluebeam Revu x64");
                    if (!hPRAZChem.Equals(IntPtr.Zero))
                    {
                        ProcessHandlers.SetForegroundWindow(hPRAZChem);
                    }
                    p.WaitForInputIdle();

                    Thread.Sleep(3000);


                    sendkeyevent(1, "%");
                    //  sendkeyevent(1, "{RIGHT}");
                    sendkeyevent(1, "{DOWN}");
                    sendkeyevent(7, "{RIGHT}");
                    sendkeyevent(1, "{ENTER}");
                    sendkeyevent(1, "{DOWN}");
                    sendkeyevent(1, "{ENTER}");

                    IntPtr hPRAZChem1 = ProcessHandlers.FindWindow(null, "Add Files for Batch Processing");
                    p.WaitForInputIdle();
                    if (!hPRAZChem1.Equals(IntPtr.Zero))
                    {
                        ProcessHandlers.SetForegroundWindow(hPRAZChem1);
                    }
                    p.WaitForInputIdle();

                    SendKeys.SendWait(folderpath);
                    Thread.Sleep(10000);
                    if (folderpath.Contains(".pdf"))
                    {
                        sendkeyevent(4, "{ENTER}");
                    }
                    else
                    {
                        sendkeyevent(1, "{ENTER}");
                        Thread.Sleep(3000);
                        sendkeyevent(8, "{TAB}");
                        sendkeyevent(1, "^(a)");
                        // SendKeys.SendWait("{A}");
                        sendkeyevent(4, "{ENTER}");
                    }
                    checkprogress();
                    checkprogress();
                    p.WaitForInputIdle();
                    ProcessHandlers.killapp("Revu");
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }