senatin Posted February 3, 2022 Share Posted February 3, 2022 (edited) While Searching For my main problem I bumb into a reply That was so useful about Changing the time GUIRegisterMsg($WM_TIMER) is Triggered. Unfortunately I Lost The File and I couldn't Recall and can't Find The Topic wherein because it has been long time. the Script was, As I recall, Like This GUIRegisterMsg($WM_TIMER, "PlayAnim") Set$WM_Timer(3000) Sleep(9000) Set$WM_Timer(1000) Sleep(9000) Function PlayAnim() { consolewrite("TickTimer") } The result: it write TickTimer every 3sec within 9 seconds after 9 seconds the console will write every 1 sec. Edited February 3, 2022 by senatin Link to comment Share on other sites More sharing options...
Solution Nine Posted February 3, 2022 Solution Share Posted February 3, 2022 You could use AdlibRegister function. It would make your life easier. You can also use _Timer UDF. But if you insist, you could use this : #include <GUIConstants.au3> #include <Constants.au3> #include <WinAPISysWin.au3> Global Const $nID = 50 Global $hGUI = GUICreate("Timer") GUISetState() GUIRegisterMsg($WM_TIMER, WM_TIMER) Global $hTimer = _WinAPI_SetTimer($hGUI, $nID, 3000, 0) If Not $hTimer Then Exit MsgBox($MB_SYSTEMMODAL, "", "Failed") Sleep(9000) Global $hTimer = _WinAPI_SetTimer($hGUI, $nID, 1000, 0) If Not $hTimer Then Exit MsgBox($MB_SYSTEMMODAL, "", "Failed") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_KillTimer($hGUI, $nID) Func WM_TIMER($hWndGUI, $MsgID, $WParam, $LParam) ConsoleWrite("hWndGUI: " & $hWndGUI & " MsgID: " & $MsgID & " wParam: " & $WParam & " lParam: " & $LParam & @CRLF) EndFunc ;==>WM_TIMER senatin 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ad777 Posted February 3, 2022 Share Posted February 3, 2022 @senatin expandcollapse popup#include <Misc.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> GUIRegisterMsg($WM_TIMER, "PlayAnim") Opt('TrayAutoPause', 0) Local $hTimer = DllCallbackRegister('PlayAnim', 'none', 'hwnd;uint;uint_ptr;dword') Global $pre_timer, $_state = Number("1"), $_state_1 = Number("1"), $timer_id Do SetWM_Timer(3000) Sleep(9000) SetWM_Timer(1000) Sleep(9000) Until _IsPressed('1B') Func PlayAnim($hWnd, $iMsg, $iTimerID, $iTime) #forceref $hWnd, $iMsg, $iTimerID, $iTime consolewrite("TickTime" & @CRLF) EndFunc ;==>PlayAnim Func SetWM_Timer($timer) if $_state = Number("1") Then if $_state_1 = Number("1") Then _WinAPI_KillTimer(0, $timer_id) DllCallbackFree($hTimer) Local $hTimer = DllCallbackRegister('PlayAnim', 'none', 'hwnd;uint;uint_ptr;dword') $timer_id = _WinAPI_SetTimer(0, 0, $timer, DllCallbackGetPtr($hTimer)) EndIf $pre_timer = $timer $_state_1 = Number("0") $_state = Number("0") EndIf if $timer <> $pre_timer Then _WinAPI_KillTimer(0, $timer_id) DllCallbackFree($hTimer) Local $hTimer = DllCallbackRegister('PlayAnim', 'none', 'hwnd;uint;uint_ptr;dword') $timer_id = _WinAPI_SetTimer(0, 0, $timer, DllCallbackGetPtr($hTimer)) $_state = Number("1") $_state_1 = Number("1") EndIf EndFunc ;==>SetWM_Timer senatin 1 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
senatin Posted February 3, 2022 Author Share Posted February 3, 2022 THank you Guys. Either of the two works perfectly As I needed. I can't remember which one is same to the Old Script I got But, They have same Concept So Thank you 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