trucu Posted April 11, 2010 Share Posted April 11, 2010 Here my problem I using _Timer_settimer for future run of a script, but this script is running at the same time. I got my WM_TIMER waiting for the TimerID but if the script is running this func does not run. What can I do? Link to comment Share on other sites More sharing options...
trucu Posted April 11, 2010 Author Share Posted April 11, 2010 Here is my problem Im running a Script that is working with a timer, but this script is also making new _Timer_SetTimer for a WM_TIMER to check and run the script again. But I got multuples variables in that script. is like Timer1 60 sc or what the script says Timer2 70 sec Timer3 80 sec the scripts takes like 20 sc to run So WM_TIMER doesnt read the Timer2 cos the script is running. is there another way or better a way to save the timer and put another script to check it out this original, so this can say to the original script that there was a timer that past so better run it ASAP. What can I do? Link to comment Share on other sites More sharing options...
eltorro Posted April 28, 2010 Share Posted April 28, 2010 Without seeing your script, I can only help you by showing you how you can use multiple timers by callbacks or WM_TIMER message. Maybe you can adapt this to your needs. expandcollapse popup#Include <Timers.au3> Global Const $WM_TIMER = 0x0113 Global $hTimer1 Global $hTimer2 Exit(Main()) Func Main() Local $iCount Local $hTimerGUI = GuiCreate("timer") ;separate callbacks $hTimer1= _Timer_SetTimer($hTimerGUI, 1000, "_Timer1_CallBack") $hTimer2= _Timer_SetTimer($hTimerGUI, 1500, "_Timer2_CallBack") While 1 sleep(10) $iCount += 1 If $iCount = 500 Then ExitLoop WEnd _Timer_KillAllTimers($hTimerGUI) ConsoleWrite(@LF) ;combined callbacks $hTimer1= _Timer_SetTimer($hTimerGUI, 1000, "_Timer3_CallBack") $hTimer2= _Timer_SetTimer($hTimerGUI, 1500, "_Timer3_CallBack") $iCount = 0 While 1 sleep(10) $iCount += 1 If $iCount = 500 Then ExitLoop WEnd _Timer_KillAllTimers($hTimerGUI) ConsoleWrite(@LF) ;combined callbacks $WM_TIMER GUIRegisterMsg($WM_TIMER,"_WM_TIMER_Message") $hTimer1= _Timer_SetTimer($hTimerGUI, 1000) $hTimer2= _Timer_SetTimer($hTimerGUI, 1500) $iCount = 0 While 1 sleep(10) $iCount += 1 If $iCount = 500 Then ExitLoop WEnd _Timer_KillAllTimers($hTimerGUI) GUIRegisterMsg($WM_TIMER,"") GUIDelete($hTimerGUI) Return 1 EndFunc ;separate callback for timer 1 Func _Timer1_Callback($hWnd, $Msg, $iIDTimer, $dwTime) ConsoleWrite("Timer1 executed."&@LF) EndFunc ;separate callback for timer 2 Func _Timer2_Callback($hWnd, $Msg, $iIDTimer, $dwTime) ConsoleWrite("Timer2 executed."&@LF) EndFunc ;combined callback ;check timer id Func _Timer3_Callback($hWnd, $Msg, $iIDTimer, $dwTime) Switch $iIDTimer Case $hTimer1 ConsoleWrite("[Timer1] executed."&@LF) Case $hTimer2 ConsoleWrite("[Timer2] executed."&@LF) EndSwitch EndFunc ;Combined callback with WM_TIMER message Func _WM_TIMER_Message($hWnd, $Msg, $iIDTimer, $dwTime) Switch $iIDTimer Case $hTimer1 ConsoleWrite("{Timer1} executed."&@LF) Case $hTimer2 ConsoleWrite("{Timer2} executed."&@LF) EndSwitch EndFunc senatin 1 Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code 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