找回密码
 加入
搜索
楼主: yjw83523

[AU3基础] 定时器怎么做呀

 火... [复制链接]
发表于 2011-10-14 17:43:21 | 显示全部楼层
就用15楼的吧  循环的
发表于 2011-10-14 17:44:06 | 显示全部楼层
别忘了时间自己设一下sleep(1000)=1秒
发表于 2011-10-21 03:10:36 | 显示全部楼层
学习中~!~~~~~~
发表于 2011-10-21 03:15:46 | 显示全部楼层
Opt("TrayMenuMode", 1)

#include <Date.au3>
#include <Misc.au3>
#include "Services.au3"
_Singleton(@ScriptName)
;如果已运行则退出
RegWrite('HKEY_CURRENT_USER\Control Panel\International', "sTimeFormat", "REG_SZ", "HH:mm:ss")
;注册表立即生效
DllCall("user32.dll", "int", "SendMessageTimeout", "hwnd", 65535, "int", 26, "int", 0, "int", 0, "int", 0, "int", 1000, "str", "dwResult")

$CFG_Path = @ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".ini"

$sleephour = IniRead($CFG_Path, "参数设置", "重启间隔", "2")

If $sleephour < 0.02 Then $sleephour = 24

If $sleephour < 1 Then
        $nexthour = _DateAdd('n', Int($sleephour * 60), _NowCalc())
Else
        $nexthour = _DateAdd('h', $sleephour, _NowCalc())
EndIf


While 1
        Sleep(1000)
        time()
WEnd

Func time()
        $sleephour = IniRead($CFG_Path, "参数设置", "重启间隔", "2")
        If @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC = $nexthour Then
                If $sleephour < 1 Then
                        $nexthour = _DateAdd('n', Int($sleephour * 60), _NowCalc())
                Else
                        $nexthour = _DateAdd('h', $sleephour, _NowCalc())
                EndIf
                runp()
        EndIf

EndFunc   ;==>time

Func runp()
;在这里加入你想做的事
EndFunc   ;==>runp

Func exit_0()
        Exit
EndFunc   ;==>exit_0
发表于 2011-11-12 14:04:12 | 显示全部楼层
受教了。tks
发表于 2012-5-8 11:11:40 | 显示全部楼层
记号,学习了
发表于 2012-6-9 22:25:52 | 显示全部楼层
占用cpu比较多
发表于 2013-2-6 10:07:06 | 显示全部楼层
记下!~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-18 03:25 , Processed in 0.097814 second(s), 13 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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