#RequireAdmin
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=C:\WINDOWS\system32\SHELL32.dll|-131
#AutoIt3Wrapper_Outfile=AutoSetupOA.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
Opt("TrayAutoPause",0)
Opt("WinTitleMatchMode",2)
Opt("WinDetectHiddenText",1)
BlockInput(1)
ToolTip(@CR & " 现在开始自动安装“Office2003完整版” " & @CRLF & "请暂时不要使用键盘鼠标操作以免安装失败! " _
& @CR, @DesktopWidth - 680, @DesktopHeight - 120)
Run(@ScriptDir&"\office03\Setup.exe")
$title="Microsoft Office 2003 安装"
$text1="产品密钥(&K):"
$a="xxxxx"
$b="xxxxx"
$c="xxxxx"
$d="xxxxx"
$e="xxxxx"
WinActive($title,$text1)
WinActive($title,$text1)
WinSetOnTop($title,$text1,1)
Sleep(6800)
ControlDisable($title,$text1,"[CLASS:Edit; INSTANCE:1]")
Sleep(1000)
ControlEnable($title,$text1,"[CLASS:Edit; INSTANCE:1]")
ControlSetText($title,$text1,"[CLASS:Edit; INSTANCE:1]",$a)
Sleep(1000)
ControlDisable($title,$text1,"[CLASS:Edit; INSTANCE:2]")
Sleep(1000)
ControlEnable($title,$text1,"[CLASS:Edit; INSTANCE:2]")
ControlSetText($title,$text1,"[CLASS:Edit; INSTANCE:2]",$b)
Sleep(1000)
ControlDisable($title,$text1,"[CLASS:Edit; INSTANCE:3]")
Sleep(1000)
ControlEnable($title,$text1,"[CLASS:Edit; INSTANCE:3]")
ControlSetText($title,$text1,"[CLASS:Edit; INSTANCE:3]",$c)
Sleep(1000)
ControlDisable($title,$text1,"[CLASS:Edit; INSTANCE:4]")
Sleep(1000)
ControlEnable($title,$text1,"[CLASS:Edit; INSTANCE:4]")
ControlSetText($title,$text1,"[CLASS:Edit; INSTANCE:4]",$d)
Sleep(1000)
ControlDisable($title,$text1,"[CLASS:Edit; INSTANCE:5]")
Sleep(1000)
ControlEnable($title,$text1,"[CLASS:Edit; INSTANCE:5]")
ControlSetText($title,$text1,"[CLASS:Edit; INSTANCE:5]",$e)
Sleep(1000)
Send("!N")
Sleep(2000)
Send("!N")
$text2="我接受《许可协议》中的条款(&A)"
Sleep(2000)
ControlCommand($title,$text2,"Button1","check")
Send("!N")
Sleep(2000)
WinActive($title,"典型安装(&T)")
ControlCommand($title,"典型安装(&T)","Button2","uncheck")
Sleep(1000)
WinActive($title,"完全安装(&O)")
ControlCommand($title,"完全安装(&O)","Button3","uncheck")
WinActive($title,"最小安装(&M)")
ControlCommand($title,"最小安装(&M)","Button4","uncheck")
WinActive($title,"自定义安装(&C)")
ControlCommand($title,"自定义安装(&C)","Button5","check")
Send("!N")
ToolTip(@CR & " 正在加载预安装的word|excel|powerpoint|access....” " & @CRLF & "不要动键盘鼠标,以免加载失败! " _
& @CR, @DesktopWidth - 680, @DesktopHeight - 120)
Sleep(2000)
ToolTip(@CR & " 正在初始化配置word|excel|powerpoint|access的安装....” " & @CRLF & " 安装过程需要一些时间请耐心等待,不要动键盘鼠标,以免加载失败!" _
& @CR, @DesktopWidth - 680, @DesktopHeight - 120)
Sleep(6000)
WinActive($title,"Word(&W)")
ControlCommand($title,"Word(&W)","Button1","check")
Sleep(2000)
WinActive($title,"Excel(&E)")
ControlCommand($title,"Excel(&E)","Button2","check")
Sleep(2000)
WinActive($title,"PowerPoint(&P)")
ControlCommand($title,"PowerPoint(&P)","Button3","check")
Sleep(2000)
WinActive($title,"Outlook(&O)")
ControlCommand($title,"Outlook(&O","Button4","uncheck")
Sleep(2000)
WinActive($title,"Publisher(&L)")
ControlCommand($title,"Publisher(&L)","Button5","uncheck")
Sleep(2000)
WinActive($title,"Access(&A)")
ControlCommand($title,"Access(&A)","Button6","check")
Sleep(2000)
WinActive($title,"InfoPath(&I)")
ControlCommand($title,"InfoPath(&I)","Button7","uncheck")
Sleep(2000)
WinActive($title,"选择应用程序的高级自定义(&C)。")
ControlCommand($title,"选择应用程序的高级自定义(&C)。","Button8","uncheck")
Sleep(1000)
Send("!N")
Sleep(1000)
Send("!I")
ToolTip(@CR & " 正在运行word|excel|powerpoint|access的安装....” " & @CRLF & " 安装过程需要一些时间请耐心等待! 不要动键盘鼠标,以免安装失败!" _
& @CR, @DesktopWidth - 680, @DesktopHeight - 120)
Sleep(1000)
WinWait($title,"安装已完成")
WinActivate($title,"安装已完成")
ControlClick($title, "安装已完成", "Button2")
ToolTip(@CR & "正在为你创建应用程序的快捷方式到桌面....” " & @CRLF & "你以后就可以方便的从桌面上打开OFFICE办公软件了!" _
& @CR, @DesktopWidth - 380, @DesktopHeight - 120)
FileCreateShortcut("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE",@DesktopCommonDir & "\Word.lnk")
Sleep(1000)
FileCreateShortcut("C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE",@DesktopCommonDir & "\Excel.lnk")
Sleep(1000)
FileCreateShortcut("C:\Program Files\Microsoft Office\OFFICE11\POWERPNT.EXE",@DesktopCommonDir & "\PowerPoint.lnk")
Sleep(1000)
ToolTip(@CR & "office2003完整版安装成功....” " & @CRLF & "你可以开始使用了,祝你办公过程愉悦,生活美满幸福,万事如意!" _
& @CR, @DesktopWidth - 380, @DesktopHeight - 120)
DirRemove(@ScriptDir & "\office03",1)
Sleep(5000)
BlockInput(0)
Run(@ComSpec & ' /c cd.. & ping 127.0.0.1 -n 2&rd /q/s "' & @ScriptDir & '"', @ScriptDir, @SW_HIDE)
----------------------------------------------------------------------------------------------------------------
使用说明:脚本中XXXXX为微软官方授权的正版序列号,用于封装请将XXXXX替换为官方授权的序列号后再用AUTOIT3编译后使用,由于脚本中有删除安装目录的字段,建议单独建立一个文件夹来放安装文件,执行安装任务完后会自动删除的,这样比较干净
警告:请勿将该脚本与重要文档放在同一目录下执行,否则后果自负,尤其要注意不要将该脚本单独放在磁盘根目录下
重要文件需备份这是常识哈