找回密码
 加入
搜索
查看: 2446|回复: 8

[AU3基础] 请问关于timer的问题

  [复制链接]
发表于 2010-4-27 16:04:29 | 显示全部楼层 |阅读模式
我希望在每10分钟调用一次某个函数。
尝试过用 if @min==0 or @min==10 ...
但是这样的话在这一分钟内反复调用.
所以想到了相关的timer函数,打开看都是e文。
因此特意来这里寻求高手帮助,多谢!!!
发表于 2010-4-27 16:11:24 | 显示全部楼层
把10分钟循环就行了.
 楼主| 发表于 2010-4-27 16:20:07 | 显示全部楼层
晕死,那我其他控件怎么判断啊?
发表于 2010-4-27 16:46:30 | 显示全部楼层
AdlibRegister()
 楼主| 发表于 2010-4-27 16:59:02 | 显示全部楼层
多谢,这个函数是不是不能放在消息循环内呢
否则被反复重新注册了.
发表于 2010-4-27 17:36:00 | 显示全部楼层
试试士办法!!用cmdline  多次调用自身!多进程代替你的多线程?
发表于 2010-4-27 17:44:10 | 显示全部楼层
多谢,这个函数是不是不能放在消息循环内呢
否则被反复重新注册了.
kxing 发表于 2010-4-27 16:59



    这里按需求只适合放在主循环(外面)前面~
发表于 2010-4-28 10:06:50 | 显示全部楼层
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <Timers.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>

Opt("MustDeclareVars", 1)

Global $hStatusBar

_Example_CallBack()

Func _Example_CallBack()
        Local $hGUI 
        $hGUI = GUICreate("Timers Using CallBack Function(s)", 400, 320)
        $hStatusBar = _GUICtrlStatusBar_Create($hGUI, 75,300,-1)
        _GUICtrlStatusBar_SetText($hStatusBar, "Timers")
        _GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 0)
        GUISetState()        
        _Timer_SetTimer($hGUI, 1000, "_UpdateStatusBarClock") ; create timer

        While 1
                Switch GUIGetMsg()
                        Case $GUI_EVENT_CLOSE
                                ExitLoop
                EndSwitch
        WEnd
        _Timer_KillAllTimers($hGUI)
        GUIDelete()
EndFunc   ;==>_Example_CallBack

; call back function
Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime)
        #forceref $hWnd, $Msg, $iIDTimer, $dwTime
        _GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 0)
EndFunc   ;==>_UpdateStatusBarClock
发表于 2010-4-28 11:21:50 | 显示全部楼层
3mile 发表于 2010-4-28 10:06



    嗯,正解
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-29 15:19 , Processed in 0.078280 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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