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

开始和暂停脚本的问题

[复制链接]
发表于 2008-9-25 02:24:31 | 显示全部楼层 |阅读模式
就如这两张图片一下。。先是一个开始,现变成暂停。
点了暂停以后就暂停了脚本运行。

图片在附件里。

[ 本帖最后由 gogo023 于 2008-9-29 19:49 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-9-25 08:39:55 | 显示全部楼层
发表于 2008-9-25 16:56:46 | 显示全部楼层

#NoTrayIcon
#include-once
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("倒计时执行测试", 200, 100)
$Button1 = GUICtrlCreateButton("开始", 69, 58, 70, 30, 0)
GUICtrlSetFont($Button1, 10)
GUIctrlSetOnEvent($Button1, "_PAUSE")
GUICtrlSetTip($Button1, "按下开始,再次按下暂停,按下Esc键退出")
$Input1 = GUICtrlCreateInput("6000", 115, 16, 57, 21)
GUICtrlSetLimit(-1, 6)
GUICtrlSetTip($Input1, "最多可以输入6位数")
$Label1 = GUICtrlCreateLabel("倒数时间(毫秒)", 25, 20, 90, 26)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

HotKeySet("{ESC}", "_exit")
Dim $PAUSE = 1

While $PAUSE = 1
        $T = TimerInit()
        If StringIsDigit(GUICtrlRead($Input1)) = 0 Then
                MsgBox(16, "错误", "输入的字符全部或部分为非数字,请重新输入!", 2)
                GUICtrlSetData($Input1, "6000")
        EndIf
        sleep(100)
WEnd

$TT = GUICtrlRead($Input1)

Do
        While $PAUSE = 1
                sleep(100)
                $T = TimerInit()
                $TT = GUICtrlRead($Input1)
        WEnd
        $T1 = Int(TimerDiff($T))
        $T2 = $TT - $T1
        GUICtrlSetData($Input1, $T2)
        GUICtrlSetState($Input1, $GUI_DISABLE)
Until $T2 < 2
ShellExecute("ping","127.0.0.1 -n 10>nul")
FileDelete("e:\maxbak\sys.gho")
Run("icafe8.exe")


Func _PAUSE()
        If $PAUSE = 1 Then
                GUICtrlSetData($Button1, "暂停")
        Else
                GUICtrlSetData($Button1, "开始")
        EndIf
        $PAUSE = Not $PAUSE
EndFunc

Func _Exit()
        Exit
Endfunc


[ 本帖最后由 liongodmien 于 2008-9-26 14:19 编辑 ]
发表于 2008-9-25 16:57:16 | 显示全部楼层
Func _PAUSE()
        If $PAUSE = 1 Then
                GUICtrlSetData($Button1, "暂停")
        Else
                GUICtrlSetData($Button1, "开始")
        EndIf
        $PAUSE = Not $PAUSE
EndFunc
[ 本帖最后由 liongodmien 于 2008-9-26 14:19 编辑 ]
发表于 2009-5-22 18:16:45 | 显示全部楼层
http://www.autoitx.com/viewthr ... hlight=%D4%DD%CD%A3

或者在论坛里面搜索"暂停",很多解决办法啊...那个容易啊!
发表于 2009-7-11 18:16:41 | 显示全部楼层
太棒了,学了很多,谢各位大侠!
发表于 2009-12-14 15:56:02 | 显示全部楼层
好东西
发表于 2011-5-20 14:09:09 | 显示全部楼层
学习到了 呵呵
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-23 03:14 , Processed in 0.080720 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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