到达指定时间自动执行所需操作的脚本例子

; 到达指定时间自动执行所需操作的脚本例子
; 注意:必须使用附带的修改版InstallOption或者是新版的InstallOptionEx插件方可实现!
;--------------------------------
;添加插件目录
!AddPluginDir .
!include LogicLib.nsh
;定义INI文件
!define INI $PLUGINSDIRAuto.ini
;定义自定义页面句柄存放变量
var hwnd
Name AutoRun
OutFile AutoRun.exe
;--------------------------------
;自定义页面
Page custom SetCustom LeaveCustom
Section Nil
SectionEnd
Function .onInit
;创建临时插件目录并释放INI文件
 InitPluginsDir
 File /oname=${INI} "Auto.ini"
FunctionEnd
Function .onGUIEnd
;释放插件
 Delay::Free
FunctionEnd
Function SetCustom
 Var /GLOBAL PageDone
 IntCmp $PageDone 1 free
 InstallOptions::initDialog /NOUNLOAD ${INI}
 Pop $hwnd
 GetDlgItem $0 $hwnd 1201
 ;此处的倒计时时间(5秒)必须与ini中定义一致!
 Delay::DelayButton /NOUNLOAD $0 5 ""
 StrCpy $PageDone 1
 InstallOptions::Show
 Goto end
 free:
 Delay::Free
 end:
FunctionEnd
Function LeaveCustom
;这个函数中存放你要执行的操作代码
 MessageBox MB_OK '完成!'
FunctionEnd
© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容