1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#cs Au3 版本: v3. 3.9 . 21 (Beta) 脚本作者:boyhong 技术介绍: http: //boyhong.blog.51cto.com #ce #NoTrayIcon # include < Date .au3> ; 请置于程序顶部 $g_szVersion = "CheckCad" If WinExists($g_szVersion) Then Exit ; 此程序已经运行了 AutoItWinSetTitle($g_szVersion) Local $iniconfig = @ScriptDir & "\config.ini" Local $Version = IniRead($iniconfig, "cad" , "Version" , "NotFound" ) ;今后升级这个配置文件中的版本号即可。比如: 1.0 1.1 ....以此类推。 If $Version = "NotFound" Then Exit (MsgBox( 14 , "有误:" , "配置文件中[Version]读取失败." )) Local $readme = IniRead($iniconfig, "cad" , "readme" , "NotFound" ) ;弹窗的话语。 If $readme = "NotFound" Then Exit (MsgBox( 14 , "有误:" , "配置文件中[readme]读取失败." )) Local $file = IniRead($iniconfig, "cad" , "file" , "NotFound" ) ;可压缩好包放置在某可访问共享目录下,比如:\\ip\JCT.ZIP 并手动修改好配置文件 If $file = "NotFound" Then Exit (MsgBox( 14 , "有误:" , "配置文件中[file]读取失败." )) ElseIf FileExists($file) = 0 Then Exit (MsgBox( 14 , "有误:" , "不能访问的物理路径:" & $file)) EndIf Local $localiniconfig = @AppDataDir & "\" & @UserName & " JCTCAD.ini" Local $localVersion = IniRead($localiniconfig, "cad" , "Version" , "" ) If $Version <> $localVersion Then $tmpname = "Update" & $Version & @YEAR & @MON & @MDAY & StringRight($file, 4 ) ;在用户终端构造一个个性的文件名。 If FileCopy($file, @DesktopDir & "\" & $tmpname, 1 ) Then Run( 'explorer /select, "' & @DesktopDir & "\ " & $tmpname & '" ') If MsgBox( 262144 + 1 , "提示:" , $readme & @LF & @LF & "相关文件已更新到桌面,点击确定,不再提示." ) = 1 Then IniWrite($localiniconfig, "cad" , "Version" , $Version) ;将服务器上的版本号更新到本地来 IniWrite($localiniconfig, "cad" , "time" , _Now()) ;将更新时间写到本地 EndIf Else SplashTextOn( "Title" , "拷贝更新失败" , 200 , 50 , - 1 , - 1 , 1 ) Sleep( 3000 ) SplashOff() EndIf Else SplashTextOn( "Title" , @UserName & "已于:" & IniRead($localiniconfig, "cad" , "time" , "NotFound" ) & "确认过更新." , 500 , 50 , - 1 , - 1 , 1 ) Sleep( 3000 ) SplashOff() EndIf Exit |
1
2
3
4
|
[cad] Version=1.0 readme=公司正在推进标准化的字体与图框.请参照内带的说明文档进行更新. file=\\172.16.128.25\kaba\temp\readme.rar |
1
2
3
4
5
|
On error resume next wscript.sleep 4000 Set wshShell = CreateObject( "Wscript.Shell" ) strPath = wshShell.CurrentDirectory wshshell.run \\IP\上边生成的.exe |