Autoit实现自动化安装Xmind8的实例,用到了2个func 进行定义函数。
安装过程中会进行判断,安装包是否存在,如果存在则直接进行安装,不存在额下载完再安装。
_Install_Xmind8() ;Xmind8 判断D:\Download目录下Xmind安装包是否存,如果存在则直接进行安装,不存在则先从共享云端下载到D:\Download目录下再进行安装。 Func _Install_Xmind8() If FileExists("D:\Download\xmind8\xmind-pro-8-windows.exe") Then _Xmind8install() else _DirCopy("\\server1\xmind8","D:\Download\") Sleep(2000) _Xmind8install() Sleep(2000) MsgBox(0, "安装完成", "Xmind8已安装完成。", 5) EndIf EndFunc Func _Xmind8install() ;xmind8安装过程 Run("D:\Download\xmind8\xmind-pro-8-windows.exe") WinWaitActive("Setup - XMind","Welcome to the XMind Setup Wizard") Sleep(500) Send("!N") WinWaitActive("Setup - XMind","License Agreement") Sleep(500) Send("!A") Sleep(500) Send("!N") WinWaitActive("Setup - XMind","Select Destination Location") Sleep(500) Send("!N") WinWaitActive("Setup - XMind","Select Additional Tasks") Sleep(500) Send("!N") WinWaitActive("Setup - XMind","Ready to Install") Sleep(500) Send("!I") WinWaitActive("Setup - XMind","Completing the XMind Setup Wizard") Sleep(500) Send("{space}") Sleep(500) Send("!F") WinWaitActive("局域网共享") Sleep(500) Send("{ENTER}") WinWaitActive("Bonjour","欢迎使用 Bonjour 安装程序") Sleep(500) Send("!N") WinWaitActive("Bonjour","许可协议") Sleep(500) Send("!A") Sleep(500) Send("!N") WinWaitActive("Bonjour","请阅读以下信息。") Sleep(500) Send("!I") WinWaitActive("Bonjour","恭喜您!") Sleep(500) Send("!F") WinWaitActive("局域网共享") Sleep(500) Send("{ENTER}") Sleep(1000) If WinExists("Windows 安全警报","Windows Defender 防火墙已经阻止此应用的部分功能") Then WinWaitActive("Windows 安全警报","Windows Defender 防火墙已经阻止此应用的部分功能") Sleep(500) Send("!A") Else WinWaitActive("主页 -XMind","新建") Sleep(500) Send("!H") Sleep(500) Send("L") WinwaitActive("","激活XMind Pro功能") Sleep(500) Send("{Tab 2}") Sleep(500) Send("{Enter}") WinwaitActive("序列号","如您已购买XMind 8 Pro/Plus 序列号, 请在此输入序列号及邮箱.") Sleep(500) ControlSend('','','','输入激活账号') Sleep(500) Send("{Tab}") Sleep(500) ControlSend('','','','输入激活License') Sleep(500) Send("{Enter}") EndIf EndFunc