Leaderboard
Popular Content
Showing content with the highest reputation on 03/04/2022 in all areas
-
Hmm, JP did a fix for that but it looks like it has a bug in it so I need to rethink. If I can fix it tomorrow I'll give it a go.5 points
-
I strongly believe Map datatype is mature enough to enter AutoIt release thru the main door!5 points
-
Latest update just released. See below for change log.3 points
-
I'm leaving it in the release but still with the experimental tag. I struggle to remember the nature of the bug with them...2 points
-
No problem. JP was creating alpha versions with all fixes that he did whilst I was absent, but I've been possibly overly risk averse in adding all those changes to the main code. I've been looking at the patches and doing a gut reaction on: Totally, that fixes something in an obvious way Ok, let me think about that...hmm... yep looks good This will take me more than 10 minutes to think about....no Only the first 2 are getting implemented. It's just down to the lack of time I have for testing - no reflection on the proposed changes2 points
-
AutoIt Extension for Visual Studio Code
Danp2 reacted to HurleyShanabarger for a topic
I think this happens if you have the cursor/focus in the output window and on the source itself.1 point -
There are multiple ways to produce memory leaks. I think the following worked in previous Betas but does not work now: ; Map Memory Leak v3 $Timer = TimerInit() While TimerDiff($Timer) < 10000 For $i = 0 To 5999 Step 1 a() Next Sleep(10) WEnd Func a() Local $Map[] $Map.x = 5 EndFunc M1 point
-
Hello There, I think the following behaviour is a memory leak (v2.0 because i posted another memory leak some years ago): ; Map Memory Leak v2 Global $Map[], $Map2[], $Timer = TimerInit() While TimerDiff($Timer) < 10000 ; RAM usage will be around 120 MB after 10s For $i = 0 To 9999 Step 1 $Map = $Map2 ; $Map is now a copy of the empty map $Map2 $Map.x = $Map ; Creates the field "x" inside of $Map, it is initialized with a copy of $Map (current state) $Map = 0 ; $Map is deleted. This should also remove the copy of $Map inside $Map.x, but i think ; the copy is not deleted. Next Sleep(10) ; To keep things slow. WEnd Reproduce instructions: - Taskmanager -> Details (to see every process) - Run Script in 3.3.15.0 Beta - Observe the used process memory going up to about 120MB before the script terminates. regards M1 point
-
Sometimes HEX is not a number, its a Position for sensors
Earthshine reacted to DrPickles for a topic
I'm working with numato boards. one of the few boards that give code examples using autoit. you would be surprised at the little things that dealing with ephemeral data you have to deal with. its like the bad ol' days of doing analog to digital conversion of video, once you error check and calculate.. its gone with no turning back. sleep() hah never ever! state change is life.. if i had any formal training .. hell i would rule the world pinky! oh yea and i hate GUI programing.. people are soooo unpredictable.1 point -
Good step forward. Better to have "Experimental in StableVersion" then "Experimental in Beta". More people will start using this feature. Anyway as you said some time ago "maybe anyone can break them".1 point
-
Sometimes HEX is not a number, its a Position for sensors
Earthshine reacted to DrPickles for a topic
when working with GPIO usb boards. i found exceptions that were lost in translation when using hex to dec- dec to bin. the binary HAD to have 32 places with no spaces. anything else would confuse the hardware and give me a bad result. I also had a situation where when the binary was converted to a number it was too big and gave me some errors, so i had to convert the numbers to a string to evaluate. that is why I offered this code, its a strange situation. when dealing with the analog world with sensors i find tiny little issues that happen 1 in every million inputs that throw a wrench in the works. that being said! i will study the above code and see what i can learn from it, as this could be a milliseconds faster and any way to speed up sampling rate is a good thing.1 point -
Compare between arrays ( More than two )
ahmeddzcom reacted to pixelsearch for a topic
@ahmeddzcom: the following code should do it fine. A message will appear that product 90332 - 362 exist in P1 - P2 but not in Cons1 - Cons2 What exists in Cons1 - Cons2 is 90332 - 360 Good luck #include <Array.au3> #include <FileConstants.au3> Opt("MustDeclareVars", 1) ;========================= Local $hTimer = TimerInit() Local $aP1 = FileReadToArray(@ScriptDir&"\P1.txt") Local $aP2 = FileReadToArray(@ScriptDir&"\P2.txt") Local $iRows_P = UBound($aP1) Local $aCons1 = FileReadToArray(@ScriptDir&"\Cons1.txt") Local $aCons2 = FileReadToArray(@ScriptDir&"\Cons2.txt") Local $aCons3 = FileReadToArray(@ScriptDir&"\Cons3.txt") Local $iRows_Cons = UBound($aCons1) Local $aCons[$iRows_Cons][2] For $i = 0 To $iRows_Cons - 1 $aCons[$i][0] = $aCons1[$i] & " - " & $aCons2[$i] $aCons[$i][1] = $aCons3[$i] Next ConsoleWrite("Generating $aCons 2D array = " & Int(TimerDiff($htimer)) & " ms" & @crlf) _ArrayDisplay($aCons, "$aCons UNsorted") ;========================= Local $hTimer = TimerInit() _ArraySort($aCons) ; mandatory sort for _ArrayBinarySearch below ConsoleWrite("Sorting $aCons = " & Int(TimerDiff($htimer)) & " ms" & @crlf) _ArrayDisplay($aCons, "$aCons Sorted") ;========================= Local $hTimer = TimerInit() Local $hCons_NoTax1 = FileOpen(@ScriptDir&"\Cons_NoTax1.txt", $FO_APPEND) Local $hCons_NoTax2 = FileOpen(@ScriptDir&"\Cons_NoTax2.txt", $FO_APPEND) Local $hCons_NoTax3 = FileOpen(@ScriptDir&"\Cons_NoTax3.txt", $FO_APPEND) Local $iIndex For $i = 0 to $iRows_P - 1 $iIndex = _ArrayBinarySearch($aCons, $aP1[$i] & " - " & $aP2[$i]) If $iIndex >= 0 Then FileWriteLine($hCons_NoTax1, $aP1[$i]) FileWriteLine($hCons_NoTax2, $aP2[$i]) FileWriteLine($hCons_NoTax3, $aCons[$iIndex][1]) Else ConsoleWrite($aP1[$i] & " - " & $aP2[$i] & " not found in $aCons" & @crlf) EndIf Next FileClose($hCons_NoTax1) FileClose($hCons_NoTax2) FileClose($hCons_NoTax3) ConsoleWrite("Writing Cons_NoTax1-2-3 = " & Int(TimerDiff($htimer)) & " ms" & @crlf)1 point -
RegExp, nested look ahead
HurleyShanabarger reacted to Nine for a topic
Alright then : Local $aArray = StringRegExp($_lv_sgData, '(?|<NodeName id="|<SubNode>)(.*)(?|">|<\/)', 3)1 point -
Compare between arrays ( More than two )
ahmeddzcom reacted to pixelsearch for a topic
What I understand is the product code is a combination of P1 & P2 with a "database" corresponding to Cons1 & Cons2 & Cons3 For example, if we look at line #2 in P1 and line #2 in P2, we got "30006" & "30E", that's the key, the product code to search in the database. Now this key is found at line #462 of Cons1 and line #462 of Cons2 : "30006" & "30E" When this match is found, then retrieve line #462 in Cons3 to get the prize of this product : 11547.00 P1 & P2 got same numbers of lines (138), let's say these are the products actually available in store. Cons1 & Cons2 & Cons3 have (of course !) the same number of lines (5940) and could correspond to the list of all products available (but they're not all in store actually) Please note that not using handles for each opened text file makes it a very long process, as stated in the help file (topic FileReadLine) I feel that this whole process could be improved, sure someone will find a solution for that.1 point -
You're making your life overly difficult! Local $hex = "0123456789abcdef" ConsoleWrite(_HexToBin($hex) & @LF) Local $bin = "0111011011100011110000001" ConsoleWrite(_BinToHex($bin) & @LF) Func _HexToBin($_hex) Return StringFormat("%0" & 4 * StringLen($_hex) & "s", _UintToString(Dec($_hex), 2)) EndFunc ;==>_HexToBin Func _BinToHex($_bin) Return Hex(_StringToUint($_bin, 2)) EndFunc ;==>_BinToHex Func _StringToInt($s, $base) Return DllCall("msvcrt.dll", "int64:cdecl", "_wcstoi64", "wstr", $s, "ptr*", 0, "int", $base)[0] EndFunc ;==>_StringToInt Func _StringToUint($s, $base) Return DllCall("msvcrt.dll", "uint64:cdecl", "_wcstoui64", "wstr", $s, "ptr*", 0, "int", $base)[0] EndFunc ;==>_StringToUint Func _IntToString($i, $base) Return DllCall("msvcrt.dll", "wstr:cdecl", "_i64tow", "int64", $i, "wstr", "", "int", $base)[0] Return $aRes[0] EndFunc ;==>_IntToString Func _UintToString($i, $base) Return DllCall("msvcrt.dll", "wstr:cdecl", "_ui64tow", "uint64", $i, "wstr", "", "int", $base)[0] EndFunc ;==>_UintToString You even have signed conversions for free, as well as signed or unsigned conversions for any base in [2, 36].1 point
-
You just need to combine my 2 scripts...Try to put something up, and if you need help just post code using tag as described in the link1 point
-
An easter egg type thing I made for a program that is based on other snow animation scripts I found on these forums that I thought I would share here in case anyone found it interesting. It is just moving around a bunch of label controls on top of everything else without interfering with usage of other controls. #NoTrayIcon #include <GUIConstants.au3> Global $runTimer = TimerInit() Const $GUIWIDTH = 500, $GUIHEIGHT = 200 $hGui = GUICreate("TEST", $GUIWIDTH, $GUIHEIGHT, -1, -1, -1, BitOR($WS_EX_LAYERED, $WS_EX_COMPOSITED)) $aSnow = snowInit() $hbut = GUICtrlCreateButton('test', 100,20,50,30) GUICtrlCreateEdit('test', 100,100,200,50) GUICtrlCreateGroup("Group 1", 350, 40, 90, 140) GUICtrlCreateRadio("Radio 1", 370, 80, 60, 15) GUICtrlCreateRadio("Radio 2", 370, 120, 60, 15) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUISetState(@SW_SHOW, $hGui) AdlibRegister(snowAnimate, 40) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hbut ConsoleWrite('button' & @CRLF) EndSwitch WEnd Func snowInit() Local Const $isnowflakes = 50 ; number of snowflakes Local $aSnow[$isnowflakes][5] ; 0=length/width, 1=left (x pos), 2=top (y pos), 3=handle, 4=fall speed ; create snowflakes For $i = 0 To UBound($aSnow) - 1 $aSnow[$i][3] = GUICtrlCreateLabel("*", 0, 0, 0, 0) GUICtrlSetState(-1, $GUI_DISABLE + $GUI_HIDE) ; $GUI_DISABLE allows click thru snow but changes to grey color, $GUI_HIDE so we can show it later GUICtrlSetStyle(-1, 0) ; removes grey color but still disabled, and prevent double-clicking copying text to clipboard GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; for transparent label control over non-transparent window GUICtrlSetColor(-1, 0) ; snow color Next Return $aSnow EndFunc Func snowAnimate() Local Const $iMinR = 5 ; minimum length of the snowflake's side Local Const $iMaxR = 15; max length Local Const $creation_interval = 500 ; spawn new snowflake every X ms Local Static $lastCreationTime = 0 Local $now = TimerDiff($runTimer) For $i = 0 To UBound($aSnow) - 1 ; if this snowflake not visible yet If BitAND(GUICtrlGetState($aSnow[$i][3]), $GUI_HIDE) And ($now - $lastCreationTime > $creation_interval) Then snowRandomize($aSnow, $i, $iMinR, $iMaxR) GUICtrlSetState($aSnow[$i][3], $GUI_SHOW) $lastCreationTime = $now Else $aSnow[$i][2] += $aSnow[$i][4] ; increment y pos If Random(1,20,1) = 20 Then $aSnow[$i][1] += Random(-2, 2, 0) ; x randomness GUICtrlSetPos($aSnow[$i][3], $aSnow[$i][1], $aSnow[$i][2]) ; when it gets to bottom of screen, change to random size and x pos and move to top of screen again If $aSnow[$i][2] > $GUIHEIGHT Then snowRandomize($aSnow, $i, $iMinR, $iMaxR) EndIf EndIf Next EndFunc Func snowRandomize(ByRef $aSnow, $i, $iMinR, $iMaxR) $aSnow[$i][0] = Random($iMinR, $iMaxR, 0) ; dimension of snow $aSnow[$i][1] = Random(0 - $iMaxR, $GUIWIDTH + $iMaxR, 0) ; x position $aSnow[$i][2] = 0 - $iMaxR ; y position (out of screen at startup) $aSnow[$i][4] = Random(0.05, 2) GUICtrlSetPos($aSnow[$i][3], $aSnow[$i][1], $aSnow[$i][2], $aSnow[$i][0], $aSnow[$i][0]) GUICtrlSetFont($aSnow[$i][3] , Floor(0.25 + $aSnow[$i][0]*1.25), 800, 0, '', 4) EndFunc ;==>_Randomize1 point
-
Hi KaFu! I first want to thank you for your amazing utility! I ran across it trying to figure out how to do the same thing myself... so you saved me a lot of work! Now for my next point.... I attempted to automate your program to autosave at start up. In my testing I ran across a bit of a bug I thought I should mention. So cmdline autosave works great (thanks for the feature by the way). However when I had multiple autosaves and tried to restore with cmdline restore 1 or 2 etc. I realized it wasn't working. But would only restore the first autosave. So.... I'm not a real "coder" but after much time figuring out what exactly some of your code did (much of it is way over my head) I figured out what was wrong (maybe?) .... I see in your restore cmdline section you have two ways available -- the first for numbers and the second for restoring by name. (Right?) What is going wrong is on line 472 you have If IsInt ($__cmdline [2]) Then..... but for whatever reason the cmdlind variable is considered a string (as far as I can tell?) So IsInt always returns 0... thus always going to your name search method (line 482) which searchs for a string. But 90% of the time when restoring by cmdline number, its going to match the first auto save since they are all numbers .... so to fix this on my project I just changed line 472 to If IsInt (Number ($__cmdline [2])) then.... but I think that defeats your purpose for the "IsInt"?? (I'm not 100% clear on the "number" function) so my method 2 would be to change the string search on line 482 to limited to the first three digits If the variable contains only digits (regex?) Which I think should Work okay? But I can't help but think there is a way to make the cmdline variable be recognized as a digit to begin with? Anyway just wanted to notify you of my findings. Sorry for the long windedness... and lack of knowledge on a fix... Regards, Don1 point
-
What this script does Extracts the list of GDPR fines from website enforcementttracker.com and returns a 2D array holding all items. N.B. The numbers of the following list can be found in the script as comments. WebDriver functionality used Tested with Firefox Start geckodriver to automate Firefox from a different location (needs to be modified by you in the scripts source) Maximize the browser window Retrieve all values from the "Show n entries" dropdown and select the second to last (50 entries) Sort the table by clicking on a table header Scroll to the end of the page Search and click a button GDPR fines Version 1.au3 GDPR fines Version 2.au31 point
-
1 point