uplink477 Posted May 20, 2008 Share Posted May 20, 2008 I got a quick question, how would i go about making my script run a function say every 20 seconds? Link to comment Share on other sites More sharing options...
sandin Posted May 20, 2008 Share Posted May 20, 2008 #include <GUIConstants.au3> $time = 2 ;in seconds $Form1 = GUICreate("AForm1", 165, 113, 193, 115) $Input1 = GUICtrlCreateInput("1", 32, 32, 97, 21) GUISetState(@SW_SHOW) AdlibEnable("_myadlib", $time*1000) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func _myadlib () GUICtrlSetData($Input1, GUICtrlRead($Input1)+1) EndFunc example script is set to call func every 2 sec. Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
uplink477 Posted May 20, 2008 Author Share Posted May 20, 2008 (edited) Hmmm... thanks for the quick reply but not quite what i was after because i have already used Adlib for something else in my script.i was thinking maybe $X = 0 While 1 $X = Execute($X + 1) if $X = 200 Then Msgbox(0,"Time",$X&"=$X") $X = 0 Else sleep(1) EndIf Wend any suggestions on weather this would work or not? Edited May 20, 2008 by uplink477 Link to comment Share on other sites More sharing options...
sandin Posted May 20, 2008 Share Posted May 20, 2008 (edited) in that case use this: #include <GUIConstants.au3> $time = 2 ;in seconds $Form1 = GUICreate("AForm1", 165, 113, 193, 115) $Input1 = GUICtrlCreateInput("1", 32, 32, 97, 21) GUISetState(@SW_SHOW) $timer = TimerInit() While 1 if TimerDiff($timer) >= $time*1000 then _function() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func _function () GUICtrlSetData($Input1, GUICtrlRead($Input1)+1) $timer = TimerInit() EndFunc Edited May 20, 2008 by sandin Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now