找回密码
 加入
搜索
查看: 20652|回复: 14

[原创] 系统封转专用OFFICE2003 professional完整版全自动安装脚本

 火.. [复制链接]
发表于 2012-2-13 09:05:12 | 显示全部楼层 |阅读模式
#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编译后使用,由于脚本中有删除安装目录的字段,建议单独建立一个文件夹来放安装文件,执行安装任务完后会自动删除的,这样比较干净

警告:请勿将该脚本与重要文档放在同一目录下执行,否则后果自负,尤其要注意不要将该脚本单独放在磁盘根目录下

重要文件需备份这是常识哈
发表于 2012-2-13 10:18:20 | 显示全部楼层
谢谢开源,学习下,继续努力               
发表于 2012-3-29 21:15:15 | 显示全部楼层
没想过,这个也可以用自动脚本,学习了。
发表于 2012-4-6 19:22:53 | 显示全部楼层
这个写得不错,                 
发表于 2012-4-17 12:21:31 | 显示全部楼层
学习一下~~
发表于 2012-5-10 23:29:22 | 显示全部楼层
学习啦,谢谢
发表于 2012-5-15 23:17:00 | 显示全部楼层
谢谢分享
发表于 2012-5-20 00:20:34 | 显示全部楼层
今天让精简的Office打击了,来看看别人的代码,学习一下。
发表于 2012-5-20 08:35:09 | 显示全部楼层
厉害,想的真周到。谢谢楼主分享,像这种代码,有人会买金币的。
发表于 2012-5-25 12:18:11 | 显示全部楼层
学习一下,支持了,谢谢分享。
发表于 2012-6-3 18:13:35 | 显示全部楼层
看不懂,自己不会,学习学习了
发表于 2012-6-17 22:02:40 | 显示全部楼层
学习啦,谢谢
发表于 2012-9-2 22:16:09 | 显示全部楼层
真的不错, 谢了楼主
发表于 2012-9-23 20:23:29 | 显示全部楼层
没想过,这个也可以用自动脚本,学习了。
发表于 2012-12-5 23:07:50 | 显示全部楼层
谢谢分享,需要这个
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-21 23:56 , Processed in 0.076468 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表