Пример #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
        /// <summary>
        /// 添加信息
        /// </summary>
        public void ToAdd()
        {
            if (detailsList.Count > 0)
            {
                KillProcess("firefox");
                Process.Start(browserPath, addUrl);
                string title      = "手工新增客户 - Mozilla Firefox";
                string className  = "MozillaWindowClass";
                IntPtr m_hGameWnd = IntPtr.Zero;

                MessageBoxButtons message = MessageBoxButtons.OKCancel;
                DialogResult      dr      = MessageBox.Show("-------------------------请自行登录-------------------------\r\n“手工新增客户”页面加载完毕才可以点击确认,取消则终止!", "提示(请不要改变浏览器窗口大小)", message);
                if (dr == DialogResult.OK)
                {
                    Thread.Sleep(1000);
                    m_hGameWnd = User32API.FindWindow(className, title);
                    if (m_hGameWnd != IntPtr.Zero)
                    {
                        User32API.SwitchToThisWindow(m_hGameWnd, true);
                        Thread.Sleep(500);
                        User32API.MoveWindow(m_hGameWnd, 0, 0, 1300, 700, true);
                    }
                    else
                    {
                        MessageBox.Show("没有检测到“手工新增客户”界面,请重试!", "提示");
                        return;
                    }
                    ClickAndInPut();
                }
                else
                {
                    return;
                }
            }
            else
            {
                MessageBox.Show("没有符合条件的公司,请重新设置筛选日期和关键字!", "提示");
                return;
            }
        }
Пример #3
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");
        }