コード例 #1
0
        /// <summary>
        /// 判断是否只读
        /// </summary>
        public bool IsOnlyRead(string pptPath)
        {
            RECT rt = new RECT();

            string pptTitle   = "" + fileNameWithExtension + " - Microsoft PowerPoint";
            IntPtr m_hGameWnd = User32API.FindWindow(null, pptTitle);

            if (m_hGameWnd == IntPtr.Zero)
            {
                ppt = new PPTHelper();
                ppt.PPTOpen(pptPath);
                m_hGameWnd = User32API.FindWindow(null, pptTitle);
            }

            pptTitle   = "Microsoft Office 激活向导";
            m_hGameWnd = User32API.FindWindow(null, pptTitle);
            if (m_hGameWnd != IntPtr.Zero)
            {
                MessageBox.Show("请将Microsoft Office激活", "提示");
            }
            Thread.Sleep(1000 * 3);
            pptTitle   = "" + fileNameWithExtension + " - Microsoft PowerPoint";
            m_hGameWnd = User32API.FindWindow(null, pptTitle);
            User32API.SwitchToThisWindow(m_hGameWnd, true);
            //User32API.GetWindowRect(m_hGameWnd, out rt);
            User32API.MoveWindow(m_hGameWnd, 0, 0, 1300, 800, true);//拖动到左上角
            //MouseCliceBackGround(m_hGameWnd, 570, 50);
            MouseClick(570, 50);
            MouseClick(100, 95);

            pptTitle   = "Checking for updates";
            m_hGameWnd = User32API.FindWindow(null, pptTitle);
            if (m_hGameWnd != IntPtr.Zero)
            {
                MessageBox.Show("请将iSpring插件自动更新关闭", "提示");
            }
            Thread.Sleep(1000 * 1);
            pptTitle   = "发布为Flash";
            m_hGameWnd = User32API.FindWindow(null, pptTitle);
            if (m_hGameWnd == IntPtr.Zero)
            {
                pptTitle   = "iSpring Free";
                m_hGameWnd = User32API.FindWindow(null, pptTitle);
                User32API.SwitchToThisWindow(m_hGameWnd, true);
                User32API.GetWindowRect(m_hGameWnd, out rt);
                User32API.MoveWindow(m_hGameWnd, 0, 0, rt.Width, rt.Height, true);//拖动到左上角
                MouseClick(420, 160);
                ppt.PPTClose();
                return(true);
            }
            else
            {
                User32API.SwitchToThisWindow(m_hGameWnd, true);
                User32API.GetWindowRect(m_hGameWnd, out rt);
                User32API.MoveWindow(m_hGameWnd, 0, 0, rt.Width, rt.Height, true);//拖动到左上角
                Thread.Sleep(1000 * 1);
                MouseClick(720, 575);
                return(false);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Joker0727/Ant
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = MessageBox.Show("你确定要关闭吗!", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (result == DialogResult.OK)
            {
                PPTHelper ppt = new PPTHelper();
                ppt.PPTClose();
                e.Cancel = false;  //点击OK
            }
            else
            {
                e.Cancel = true;
            }
        }
コード例 #3
0
 static void Main(string[] args)
 {
     try
     {
         string    pptPath   = String.Format("D:\\Source Code\\AUXI_EditPowerPoint\\Auxi_PowerPointEdit\\Assets\\auxi C# Interview-1.pptx");
         PPTHelper pPTHelper = new PPTHelper();
         pPTHelper.OpenPptxFile(pptPath);
         SlidePart OutputSlide = pPTHelper.CloneInputSlide();
         PPTHelper.FormatTitle(OutputSlide);
         PPTHelper.FormatFLow(OutputSlide);
         PPTHelper.FormatBlPoint(OutputSlide);
         pPTHelper.Dispose();
     }
     finally
     {
     }
 }
コード例 #4
0
        /// <summary>
        /// 图像识别,驱动点击
        /// </summary>
        public void AutoClick(string tempPPTPath, string pptPath)
        {
            RECT rt = new RECT();

            KillProcess("POWERPNT");

            string pptTitle   = "" + fileNameWithExtension + " - Microsoft PowerPoint";
            IntPtr m_hGameWnd = User32API.FindWindow(null, pptTitle);

            if (m_hGameWnd == IntPtr.Zero)
            {
                ppt = new PPTHelper();
                ppt.PPTOpen(pptPath);
                m_hGameWnd = User32API.FindWindow(null, pptTitle);
            }

            Thread.Sleep(1000 * 5);

            pptTitle   = "Microsoft Office 激活向导";
            m_hGameWnd = User32API.FindWindow(null, pptTitle);
            if (m_hGameWnd != IntPtr.Zero)
            {
                MessageBox.Show("请将Microsoft Office激活", "提示");
            }

            pptTitle   = "" + fileNameWithExtension + " - Microsoft PowerPoint";
            m_hGameWnd = User32API.FindWindow(null, pptTitle);
            User32API.SwitchToThisWindow(m_hGameWnd, true);
            //User32API.GetWindowRect(m_hGameWnd, out rt);
            User32API.MoveWindow(m_hGameWnd, 0, 0, 1300, 800, true); //拖动到左上角

            MouseClick(570, 50);                                     //点击ispring
            MouseClick(80, 80);                                      //点击publish
            //Clipboard.Clear();
            Thread.Sleep(1000);
            pptTitle   = "Checking for updates";
            m_hGameWnd = User32API.FindWindow(null, pptTitle);
            if (m_hGameWnd != IntPtr.Zero)
            {
                MessageBox.Show("请将iSpring插件自动更新关闭", "提示");
            }

            pptTitle   = "发布为Flash";
            m_hGameWnd = User32API.FindWindow(null, pptTitle);
            if (m_hGameWnd != IntPtr.Zero)
            {
                User32API.SwitchToThisWindow(m_hGameWnd, true);
                User32API.GetWindowRect(m_hGameWnd, out rt);
                User32API.MoveWindow(m_hGameWnd, 0, 0, rt.Width, rt.Height, true);//拖动到左上角
                try
                {
                    Clipboard.Clear();
                    Clipboard.SetText(fileNameWithoutExtension);
                    MouseClick(500, 125);
                    SendKeys.SendWait("^A");
                    Thread.Sleep(500);
                    SendKeys.SendWait("{BACKSPACE}");
                    Thread.Sleep(500);
                    SendKeys.SendWait("^V");  //Ctrl+V 组合键
                    Thread.Sleep(500);
                    Clipboard.Clear();

                    //User32API.Keybd_event(VirtualKey.BACK, 0, KeyEvent.KEYEVENTF_EXTENDEDKEY, 0);
                    //Thread.Sleep(500);
                    //SendKeys.SendWait(fileNameWithoutExtension);
                }
                catch (Exception ex)
                {
                    WriteLog(ex.ToString());
                }
                try
                {
                    MouseClick(500, 175);
                    Clipboard.Clear();
                    Clipboard.SetText(tempPPTPath);
                    SendKeys.SendWait("^A");
                    Thread.Sleep(500);
                    SendKeys.SendWait("{BACKSPACE}");
                    Thread.Sleep(500);
                    SendKeys.SendWait("^V");  //Ctrl+V 组合键
                    Thread.Sleep(500);
                    Clipboard.Clear();

                    //MouseClick(500, 175);
                    //User32API.Keybd_event(VirtualKey.BACK, 0, KeyEvent.KEYEVENTF_EXTENDEDKEY, 0);
                    //Thread.Sleep(500);
                    //SendKeys.SendWait(tempPPTPath);
                }
                catch (Exception ex)
                {
                    WriteLog(ex.ToString());
                }
                MouseClick(630, 570);//点击发布

                while (true)
                {
                    Thread.Sleep(1000 * 5);
                    pptTitle   = "正在生成Flash影片 {presentation_title}";
                    m_hGameWnd = User32API.FindWindow(null, pptTitle);
                    if (m_hGameWnd == IntPtr.Zero)
                    {
                        break;
                    }
                }
                KillProcess("360chrome");
                KillProcess("360se");
                KillProcess("explorer");
                KillProcess("chrome");
                KillProcess("iexplore");
            }
            else
            {
                MessageBox.Show("PPT可能无法正常使用iSpring插件", "提示");
                return;
            }

            string tarFlash = targetPath + @"\" + fileNameWithoutExtension + @"\" + fileNameWithoutExtension + ".swf";

            if (File.Exists(tarFlash))
            {
                File.Delete(tarFlash);
            }
            string sPath = tempPPTPath + fileNameWithoutExtension + @"\" + fileNameWithoutExtension + ".swf";

            if (File.Exists(sPath))
            {
                File.Move(sPath, tarFlash);
            }

            if (ppt != null)
            {
                ppt.PPTClose();
            }
            KillProcess("POWERPNT");
        }