Recently Browsing 0 members
No registered users viewing this page.
Is there any difference in timers and AdlibRegister ?
performance usage reliability or any kind of difference I want use few timers at once so it will make difference.
I have problem with timers and I saw AdlibRegister behaves similar like:
wont stop crashing slowing program so much maybe is there any trick to make it better?
Hello what is the best way to secure autoit scripts right now?
People say prebuild stripper in SciTE is not high secure. Other problem is if I use stripper in my program I use a lot of _Timer_SetTimer functions. After stripping timers not work.
I seen this but now it not work
Next thing is https://www.pelock.com
Is it better than stripper builded in SciTE and got more secure?
Please write me ur knowledge about how to make scripts secure. I know its hard to recieve but tell me ur thoughts
I do my timers like this by clicking checkbox function is called and timer is set up.
There is a trouble cause I got so many Timers, 20 like this below and I can see if they is launched 5 timers program starts freezing and often crashing.
I know it takes memory but is is right way to do timers like that or what should i do?
Case $checkerSS If GUICtrlRead($CheckerOne) = 1 Then $ss = _Timer_SetTimer($Form1,4000,"checkScreen") Else _Timer_KillTimer ($Form1,$ss) EndIf Case $checkerPos If GUICtrlRead($DiscAlert) = 1 Then $disc = _Timer_SetTimer($Form1,20000,"checkPosition") Else _Timer_KillTimer ($Form1,$disc) EndIf Case $checkerVars If GUICtrlRead($AlertPlayerPos) = 1 Then $ap = _Timer_SetTimer($Form1,15000,"checkVars") Else _Timer_KillTimer ($Form1,$ap) EndIf
Here is my wrapper for SetTimer and KillTimer APIs.
AutoIt already has its own, but I tried to make it as simple as I could.
#include-once Global $g_avSimpleTimers = [[0, 0]] Func TimerSet($vFunction, $uInterval) Local $hFunction = DllCallbackRegister($vFunction, "none", "HWND;UINT;UINT_PTR;DWORD") If ($hFunction = 0) Then Return 0 Local $uTimerId = DllCall("user32.dll", "UINT_PTR", "SetTimer", _ "HWND", 0, _ "UINT_PTR", 0, _ "UINT", $uInterval, _ "ptr", DllCallbackGetPtr($hFunction)) If ($uTimerId = 0) Then DllCallbackFree($hFunction) Return 0 EndIf ReDim $g_avSimpleTimers[$g_avSimpleTimers + 2] $g_avSimpleTimers[$g_avSimpleTimers + 1] = $uTimerId $g_avSimpleTimers[$g_avSimpleTimers + 1] = $hFunction $g_avSimpleTimers += 1 Return $uTimerId EndFunc Func TimerUnset($uTimerId) If ($g_avSimpleTimers = 0) Then Return False Local $iCount = $g_avSimpleTimers For $i = 1 To $iCount + 1 If ($g_avSimpleTimers[$i] = $uTimerId) Then DllCall("user32.dll", "BOOL", "KillTimer", _ "HWND", 0, _ "UINT_PTR", $uTimerId) DllCallbackFree($g_avSimpleTimers[$i]) For $j = $i To $iCount - 1 $g_avSimpleTimers[$j] = $g_avSimpleTimers[$j + 1] $g_avSimpleTimers[$j] = $g_avSimpleTimers[$j + 1] Next $g_avSimpleTimers = $iCount - 1 ReDim $g_avSimpleTimers[$iCount] Return True EndIf Next Return False EndFunc Example:
#include "Simple Timers.au3" Global $t1 = TimerSet(Foo, 500) Global $t2 = TimerSet("Bar", 1000) MsgBox(0, "", "Check the console.") TimerUnset($t1) MsgBox(0, "", "Check the console again.") TimerUnset($t2) ;Not necessary if you are exiting the script Func Foo($a, $b, $c, $d) ConsoleWrite(">Foo" & @CRLF) EndFunc Func Bar($a, $b, $c, $d) ConsoleWrite("!Bar" & @CRLF) EndFunc Download both UDF and example: