找回密码
 加入
搜索
查看: 3041|回复: 7

大菜鸟救助解决下进度条的问题 (已解决)

[复制链接]
发表于 2008-5-20 12:23:47 | 显示全部楼层 |阅读模式
大菜鸟救助解决下进度条的问题
偶才刚开始学,呵呵!
编自动安装的脚本偶是学会了,可想编个界面来调用却被进度条这里卡住了
哪位大大帮忙解决下

偶是弄不明白进度条怎么才能调用进去,想让它倒数10秒自动执行安装,大大们来帮忙啊


#include <GUIConstants.au3>

GUICreate("自动安装", 401, 221, 193, 125)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("", 24, 24, 353, 137)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton ("安装", 192, 176, 83, 33, 0)
$Close = GUICtrlCreateButton ("关闭", 304, 176, 75, 33, 0)
GUISetState()

$Progress1 = GUICtrlCreateProgress(24, 184, 142, 17)

While 1
        $Msg = GUIGetMsg()
        Select
          Case $msg = $Button1
          Run('setup1.exe')
          ExitLoop

          Case $msg = $GUI_EVENT_CLOSE or $msg = $Close
          ExitLoop
      EndSelect
WEnd

[ 本帖最后由 19791111 于 2008-5-20 22:45 编辑 ]
发表于 2008-5-20 12:31:40 | 显示全部楼层
可以 使用 AdlibEnable  使进度条走
 楼主| 发表于 2008-5-20 22:32:32 | 显示全部楼层
这个真不好学呀~

弄了半天进度条这个弄好了
可是时间到了自动运行程序后却不会自动退出。
请教下要加什么代码才能执行退出呢?

#include <GUIConstants.au3>

GUICreate("自动安装", 401, 221, 193, 125)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("", 24, 24, 353, 137)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton ("安装", 192, 176, 83, 33, 0)
$Close = GUICtrlCreateButton ("关闭", 304, 176, 75, 33, 0)
$Progress1 = GUICtrlCreateProgress(24, 184, 142, 17)
GUICtrlSetColor(-1,32250)
GUISetState()
AdlibEnable("Progress2",100)
Dim $i = 1

While 1
        $Msg = GUIGetMsg()

        Select
          Case $msg = $Button1
          Run('setup1.exe')
          ExitLoop

          Case $msg = $GUI_EVENT_CLOSE or $msg = $Close
          ExitLoop
      EndSelect
WEnd

Func Progress2()
    GUICtrlSetData ($Progress1,($i/50)*100)
    $i += 1
    If $i = 50 Then Run('setup1.exe')
EndFunc
发表于 2008-5-20 22:40:42 | 显示全部楼层
#include <GUIConstants.au3>

GUICreate("自动安装", 401, 221, 193, 125)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("", 24, 24, 353, 137)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton ("安装", 192, 176, 83, 33, 0)
$Close = GUICtrlCreateButton ("关闭", 304, 176, 75, 33, 0)
$Progress1 = GUICtrlCreateProgress(24, 184, 142, 17)
GUICtrlSetColor(-1,32250)
GUISetState()
AdlibEnable("Progress2",100)
Dim $i = 1

While 1
        $Msg = GUIGetMsg()

        Select
          Case $msg = $Button1
          Run('notepad.exe')
          ExitLoop

          Case $msg = $GUI_EVENT_CLOSE or $msg = $Close 
          ExitLoop
      EndSelect
WEnd

Func Progress2()
    GUICtrlSetData ($Progress1,($i/50)*100)
    $i += 1 
    If $i = 50 Then
                Run('notepad.exe')
                Exit ;=====退出======
        EndIf
EndFunc


[ 本帖最后由 夜苦寒 于 2008-5-20 22:52 编辑 ]
 楼主| 发表于 2008-5-20 22:45:21 | 显示全部楼层
偶真是晕菜了~呵呵~

非常感谢楼上的大哥  

发表于 2009-7-10 00:50:11 | 显示全部楼层
这是不是用AdlibEnable来每隔0.5秒调用一次Progress2!而Progress2就使$i自加1!从而使进度条自动倒数?
发表于 2009-8-7 00:38:11 | 显示全部楼层
感谢回答问题的师傅们
发表于 2017-3-11 10:46:04 | 显示全部楼层
error: AdlibEnable(): 未定义的函数.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-17 07:53 , Processed in 0.080422 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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