All Activity
- Past hour
-
SoundTool Playback Devices Mute Status (Auto Unmute if Muted)
TreatJ replied to TreatJ's topic in AutoIt Example Scripts
I am not sure if others may have the same question about how to Code using the 'Ternary operators' method... but if they do... send them this little script that I just put together.... Sometimes (at least for me) coding it out like I just did can be very helpful towards giving one a better understanding of how it works Maybe others too! TernaryOpv100.au3 -
#include <Array.au3> ;RegWrite ( "keyname" [, "valuename", "type", value] ) ; [4 row] [4 column] ; columns: keyname, valuename, type, value Local $Array[4][4] = [ _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0", "showInteractiveHelp", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0", "showWelcomeHint", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0", "LicenseText", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0", "Product", "REG_DWORD", "00000000"]] ;~ _ArrayDisplay($Array, "") For $i = 0 To UBound($Array) - 1 ConsoleWrite("RegWrite (" & $Array[$i][0] & ", " & $Array[$i][1] & ", " & $Array[$i][2] & ", " & $Array[$i][3] & ")" & @CRLF) Next
-
And this... #include <Array.au3> Local $sNumofRows = 4 Local $sNumofCols = 2 Local $Array[$sNumofRows][$sNumofCols] $Array[0][0] = "$sKeyname" $Array[0][1] = "HKEY_CURRENT_USER\Software\First" $Array[1][0] = "Valuename" $Array[1][1] = "Second" $Array[2][0] = "RegSZ" $Array[2][1] = "REG_SZ" $Array[3][0] = "String" $Array[3][1] = "Fourth" For $row = 0 To UBound($Array) - 1 For $column = 0 To UBound($Array, $sNumofRows) - 1 $Array[$row][$column] = $row & ":" & $column Next Next _ArrayDisplay($Array, "")
-
3D array ; 3D array [table][row][column] Local $aProducts[3][4][4] = [ _ [ _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0", "showInteractiveHelp", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0", "showWelcomeHint", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0", "LicenseText", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0", "Product", "REG_DWORD", "00000000"] _ ], [ _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-Q\3.0", "showInteractiveHelp", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-Q\3.0", "showWelcomeHint", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-Q\3.0", "LicenseText", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-Q\3.0", "Product", "REG_DWORD", "00000000"] _ ], [ _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-R\2.0", "showInteractiveHelp", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-R\2.0", "showWelcomeHint", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-R\2.0", "LicenseText", "REG_DWORD", "00000000"], _ ["HKEY_CURRENT_USER\Software\FabFilter\Pro-R\2.0", "Product", "REG_DWORD", "00000000"] _ ]] For $t = 0 To UBound($aProducts) - 1 ;table ConsoleWrite("Part" & $t & @CRLF) For $r = 0 To UBound($aProducts, 2) - 1 ;row For $c = 0 To UBound($aProducts, 3) - 1 ;column ConsoleWrite($aProducts[$t][$r][$c] & " - ") Next ConsoleWrite(@CRLF) Next Next
-
Thanks @genius257, but I cannot run the example code above 😔 . I created a folder, pasted your two attached files in and created a example.au3 file with the code above. When I try to run this code (in VSCode) or try to use CTRL+F5 to call the Au3Check, I get several warnings and errors. ⚠I also have to say: At the moment I use the VSCode extension of Loganch, yours is disabled for now. Is that a problem 🤔 ? Are there other possible dependencies like your "vscode-autoit3-debug"? Here my VScode OUTPUT when I try to run the example above: I guess at least the two errors should not exist, right? Best regards Sven
-
ioa747, #include <Array.au3> Local $sNumofRows = 0 Local $sNumofCols = 0 Local $Array[$sNumofRows][$sNumofCols] For $row = 0 To UBound($Array) - 1 For $column = 0 To UBound($Array,$sNumofRows) - 1 $Array[$row][$column] = $row & ":" & $column Next Next _ArrayDisplay($Array, "") Observations So, apparently, you can have "0 rows and 1 column"...but NOT, "1 row and 0 columns"!! Does generates an error... Local $sNumofRows = 1 Local $sNumofCols = 0 Does not generates an error... Local $sNumofRows = 0 Local $sNumofCols = 1
-
Finally! #include <Array.au3> ;$aArray[A][B] ;[A] = Row ;[B] = Column Local $aArray[4][4] $aArray[0][0] = "Col1 Row1" $aArray[1][0] = "Col1 Row2" $aArray[2][0] = "Col1 Row3" $aArray[3][0] = "Col1 Row4" $aArray[0][1] = "Col2 Row1" $aArray[1][1] = "Col2 Row2" $aArray[2][1] = "Col2 Row3" $aArray[3][1] = "Col2 Row4" $aArray[0][2] = "Col3 Row1" $aArray[1][2] = "Col3 Row2" $aArray[2][2] = "Col3 Row3" $aArray[3][2] = "Col3 Row4" $aArray[0][3] = "Col4 Row1" $aArray[1][3] = "Col4 Row2" $aArray[2][3] = "Col4 Row3" $aArray[3][3] = "Col4 Row4" _ArrayDisplay($aArray, "") I finally SEE METHOD IN THIS!
-
mr-es335 reacted to a post in a topic: Data-To-Arrays
-
#include <Array.au3> Local $Array[4][4] For $i = 0 To UBound($Array) - 1 For $j = 0 To UBound($Array, 2) - 1 $Array[$i][$j] = $i & ":" & $j Next Next ConsoleWrite("$Array[3][3]=" & $Array[3][3] & @CRLF)
- Today
-
How is this? • To access the data in Column4, Row 4, employ: 3:3
-
DnV_Mobile_Auto joined the community
-
Getting error when attempting to open HyperV on Windows 11 Pro "An attempt was made to reference a token that does not Exist"
-
Okay, So how is this? Objective: Test for a single column with four rows! ; To test each in turn, comment-out each #cs and #ce #include <Array.au3> ;Local $aArray[A][B] ;[A] = Rows ;[B] = Columns #cs ; So, for a 1 row, 1 col array, employ: Local $aArray[1][1] Local $aArray[1][1] $aArray[0][0] = "Col1 Row1" ; To access that data, employ: ConsoleWrite($aArray[0][0] & @CRLF) ConsoleWrite($aArray[0][0] & @CRLF) #ce #cs ; For a 2 row, 1 col array, employ: Local $aArray[2][1] Local $aArray[2][1] $aArray[0][0] = "Col1 Row1" $aArray[1][0] = "Col1 Row2" ; To access that data, employ: ConsoleWrite($aArray[0][0] & $aArray[1][0] & @CRLF) ConsoleWrite($aArray[0][0] & @CRLF & $aArray[1][0] & @CRLF) #ce #cs ; For a 3 row, 1 col array, employ: Local $aArray[3][1] Local $aArray[3][1] $aArray[0][0] = "Col1 Row1" $aArray[1][0] = "Col1 Row2" $aArray[2][0] = "Col1 Row3" ; To access that data, employ: ConsoleWrite($aArray[0][0] & @CRLF & $aArray[1][0] & @CRLF& $aArray[2][0] & @CRLF) ConsoleWrite($aArray[0][0] & @CRLF & $aArray[1][0] & @CRLF & $aArray[2][0] & @CRLF) #ce #cs ; And finally, for a 4 row, 1 col array, employ: Local $aArray[4][1] Local $aArray[4][1] $aArray[0][0] = "Col1 Row1" $aArray[1][0] = "Col1 Row2" $aArray[2][0] = "Col1 Row3" $aArray[3][0] = "Col1 Row4" ; To access that data, employ: ConsoleWrite($aArray[0][0] & @CRLF & $aArray[1][0] & @CRLF & $aArray[2][0] & @CRLF & $aArray[3][0] & @CRLF) ConsoleWrite($aArray[0][0] & @CRLF & $aArray[1][0] & @CRLF & $aArray[2][0] & @CRLF & $aArray[3][0] & @CRLF) #ce ;_ArrayDisplay($aArray, "Original Array") PS: I do believe that it is imperative to understand that - in my understanding, "logic" is the key to a good programmer! I tend to consider myself a being "methodical" - not logical! Therefore, unless I am able to see clearly - a method, no amount of logic will make any sense to me....no matter how si9mple such logic is being presented. Objective 2: To test for two columns with four rows - with a focus on Column 1: ; To test each in turn, comment-out each #cs and #ce #include <Array.au3> ;Local $aArray[A][B] ;[A] = Row ;[B] = Column #cs ; So, for a 1 row, 2 col array, employ: Local $aArray[1][2] Local $aArray[1][2] $aArray[0][0] = "" $aArray[0][1] = "Col2 Row1" #ce #cs ; For a 2 row, 2 col array, employ: Local $aArray[2][2] Local $aArray[2][2] $aArray[0][0] = "" $aArray[0][1] = "Col2 Row1" $aArray[1][0] = "" $aArray[1][1] = "Col2 Row2" #ce #cs ; For a 3 row, 1 col array, employ: Local $aArray[3][3] Local $aArray[3][2] $aArray[0][0] = "" $aArray[0][1] = "Col2 Row1" $aArray[1][0] = "" $aArray[1][1] = "Col2 Row2" $aArray[2][0] = "" $aArray[2][1] = "Col2 Row3" #ce #cs ; And finally, for a 4 row, 1 col array, employ: Local $aArray[4][1] Local $aArray[4][2] $aArray[0][0] = "" $aArray[0][1] = "Col2 Row1" $aArray[1][0] = "" $aArray[1][1] = "Col2 Row2" $aArray[2][0] = "" $aArray[2][1] = "Col2 Row3" $aArray[3][0] = "" $aArray[3][1] = "Col2 Row4" #ce _ArrayDisplay($aArray, "")
-
Talking about arrays: Your code tells me that you do not understand how arrays work. Subz tried to tell you, but ... You created an array with 4 rows and 4 columns, but only fill the first column of all rows. Then you loop through all rows. Your code passes the same cell 4 times to RegWrite. That returns an error. Add debugging code to your script to make sure all function calls work properly. I already posted code in one of your threads that exaclty tells you what went wrong.
-
mr-es335 reacted to a post in a topic: Data-To-Arrays
-
water, No offense is meant to be indte4nded...so if I do come across in this manner...please forgive me... "the cause of the problem is fairly obvious"...to you apparently...but NOT to me!! "The solution is: Learn the basics of AutoIt! That includes arrays!" ...I thought that I was! I gather NOT!
-
Even without further troubleshooting information from you, the cause of the problem is fairly obvious. The solution is: Learn the basics of AutoIt! That includes arrays!
-
Another bitmap brute-forcing thread
Nine replied to Hashim's topic in AutoIt General Help and Support
Here a more comprehensive version of the script I made above. I may add the following as an additional example of my UDF. With this new version, you do not have to find the top line of the bright-green color, it will do it for you. You just need to provide the top, left, right, bottom of the whole black square, along with the number of digits to read. (in absolute screen coordinates) #include "C:\Apps\AutoIt\GetScreen\GetScreen.au3" #include <Color.au3> Opt("MustDeclareVars", True) Local $hWnd = WinActivate("Microsoft Office Picture Manager") WinWaitActive($hWnd) Global $aDigit = DefineNum() _GetScreen_Initialize(@DesktopWidth, @DesktopHeight) For $i = 1 To 10 ; number of pictures I test ReadNumber(535, 397, 710, 451, 4) ; top-left of the square .. bottom-right of the square .. Number of digits to read Send("{RIGHT}") ; move to the next picture Sleep(500) Next Func ReadNumber($iLeft, $iTop, $iRight, $iBottom, $iNumDigit) Local $hTimer = TimerInit() _GetScreen_GetScreen() ; Static will execute this only once, since top bright-green pixel is always located on the same top Y Local Static $iPosY = SearchColor($iLeft, $iTop, $iRight, $iBottom) Local $iPosX = $iLeft, $sValue For $i = 1 To $iNumDigit $sValue &= GetDigit($iPosX, $iPosY, $iRight) $iPosX = @extended Next ConsoleWrite($sValue & @CRLF) ConsoleWrite(TimerDiff($hTimer) & @CRLF) Return Int($sValue) ; in case you want to return the integer read EndFunc ;==>ReadNumber Func GetDigit($iStart, $iTop, $iEndX) For $i = $iStart To $iEndX If IsColor(_GetScreen_GetPixel($i, $iTop)) Then For $j = 0 To UBound($aDigit) - 1 For $k = 0 To UBound($aDigit[$j][2]) - 1 If Not IsColor(_GetScreen_GetPixel($i + ($aDigit[$j][2])[$k][0], $iTop + ($aDigit[$j][2])[$k][1])) Then ContinueLoop 2 Next Return SetExtended($i + $aDigit[$j][1], $aDigit[$j][0]) Next Return SetError(1) ; no digit found EndIf Next Return SetError(2) ; no green bright color found EndFunc ;==>GetDigit Func DefineNum() Local $aNum[10][3] = [[0, 14, 0], [1, 4, 0], [2, 14, 0], [8, 14, 0], [3, 14, 0], [5, 24, 0], [7, 24, 0], [4, 4, 0], [9, 24, 0], [6, 10, 0]] Local $aTmp = [[13, 15], [-3, 20], [9, 10]] ; 0 $aNum[0][2] = $aTmp Local $aTmp = [[-1, 10], [-2, 15], [-9, 30]] ; 1 $aNum[1][2] = $aTmp Local $aTmp = [[-3, 20], [-9, 30], [11, 30]] ; 2 $aNum[2][2] = $aTmp Local $aTmp = [[-4, 10], [-8, 20], [-2, 15]] ; 8 $aNum[3][2] = $aTmp Local $aTmp = [[8, 15], [3, 15], [-6, 5], [11, 25]] ; 3 $aNum[4][2] = $aTmp Local $aTmp = [[20, 0], [4, 10], [9, 10]] ; 5 $aNum[5][2] = $aTmp Local $aTmp = [[20, 0], [19, 5], [2, 20]] ; 7 $aNum[6][2] = $aTmp Local $aTmp = [[2, 20], [-18, 20], [-4, 25]] ; 4 $aNum[7][2] = $aTmp Local $aTmp = [[-6, 10], [-2, 15], [6, 25]] ; 9 $aNum[8][2] = $aTmp Local $aTmp = [[-12, 15], [-14, 25], [6, 25]] ; 6 $aNum[9][2] = $aTmp Return $aNum EndFunc ;==>DefineNum Func IsColor($nColor) Return Not _ColorGetRed($nColor) And Not _ColorGetBlue($nColor) And _ColorGetGreen($nColor) > Dec("FA") EndFunc ;==>IsColor Func SearchColor($iX1, $iY1, $iX2, $iY2) Local $nColor, $iMin = 99999, $aPos For $i = 251 To 255 $nColor = Dec(Hex($i) & "00") $aPos = _GetScreen_SearchArea($iX1, $iY1, $iX2, $iY2, $nColor) If @error Then ContinueLoop If $aPos[1] < $iMin Then $iMin = $aPos[1] Next If $iMin = 99999 Then Return SetError(1) Return $iMin EndFunc ;==>SearchColor It now reads many pictures one at a time. All results match. -
As a coder you want to become, you should know that "does not work" isn't an acceptable description of a bug
-
Hello, Thanks to sleepydvdr, the commented line works, whilst the non-commented lines does not! Why? #include <Array.au3> Local $avArray[4][4] $avArray[0][0] = "HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0" $avArray[1][0] = "BundleLicenseText" $avArray[2][0] = "REG_SZ" $avArray[3][0] = "Me" _ArrayDisplay($avArray, "") For $i = 0 To 3 ;RegWrite($avArray[0][0], $avArray[1][0], $avArray[2][0], $avArray[3][0]) RegWrite($avArray[$i][0], $avArray[$i][0], $avArray[$i][0], $avArray[$i][0]) Next
-
mr-es335 reacted to a post in a topic: Multidimensional Array Help
-
GUIFrame UDF - Melba23 version - 19 May 14
WildByDesign replied to Melba23's topic in AutoIt Example Scripts
@Melba23 Thank you for sharing this great UDF. It might be a bit of an older UDF at this point, but it still works great on the latest Windows 11. The only significant problem was flickering when resizing of apps when in dark mode. I was able to successfully smooth out the dark mode resizing issue by extending the UDF: auto-detection of when Windows is in Dark Mode or Light Mode apply Dark or Light mode styling early in the init process apply to all GUI frames individually ($hParent, $hSeparator, $hFirstFrame and $hSecondFrame) all applied before controls are even created The project that I am working on is not complete yet, so I might still have to modify GUIFrame.au3 some more. I would be happy to share my modifications when I am done. However, I don't know exactly how to share my changes in a proper way. My changes rely on (and require) the awesome Dark Mode UDF: Screenshot (not finished app): -
Subz, What is wrong with this? ...something is... #include <Array.au3> Local $aArray[0][0] ;So in your example you could use 2 dimensional array ;~ Keyname: In Excel this would be A1 $aArray[0][0] = "HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0" ;~ Valuename: In Excel this would be B1 $aArray[0][1] = "showInteractiveHelp" ;~ RegType: In Excel this would be C1 $aArray[0][2] = "REG_DWORD" ;~ RegData: In Excel this would be D1 $aArray[0][3] = "00000000" For $i = 0 To UBound($aArray) - 1 ;~ Loop from index 0 to last row of the array RegWrite($aArray[$i][0], $aArray[$i][1], $aArray[$i][2], $aArray[$i][3]) Next
-
Why not just use CSV (as below) and then FileReadToArray? Change the spreadsheet to be: Column A Keyname Column B Valuename Column C RegSZ Column D String
-
SOLVE-SMART reacted to a post in a topic: Data-To-Arrays
-
SoundTool Playback Devices Mute Status (Auto Unmute if Muted)
TreatJ replied to TreatJ's topic in AutoIt Example Scripts
By the way.... found it: Conditional operator ? : Select conditionally an expression. e.g. $condition ? $expression1 : $expression2 i did not even know that AutoIt had this capability! Thanks for the Info -
water, I use Excel to assist me with writing scripts that employ "common" data. So the sample.xls produces the following for me [I simply strip out the tabs]:
-
I had a quick look at the Excel-File you posted. OMG - Can you please tell me why you store it this way? I have never seen something like this before.
-
SoundTool Playback Devices Mute Status (Auto Unmute if Muted)
TreatJ replied to TreatJ's topic in AutoIt Example Scripts
Back in 2019 I posted and uploaded one of my bigger AutoIt Programs (Bigger for me anyway). that I named 'TxtFinderV475' and sometime later I unloaded my latest Version of it: 'TxtFinderV512'. I wrote this for my wife and decide to share it on AutoIt. In a nutshell my program searches through many Text Files for user specified text. My wife likes to store information in many (very many) different NotePad Files. So I wrote this to help her find that info. The script is zipped up with other files that it needs to work with. Once you unzip it you will see what I mean. Hope it works on your Version of Windows! Please let me know if it did or not.... Anyway take a look inside my script. Do a search for the following function... ;Func: _FindTxInFile() (Note that I have the ( ; ) in front of "Func" This will take you to the Remarks first) In this Function you will find the heart of how it works.... I just wrote my program around it... I found this code in the Autoit script examples forum. As you can see in my remarks I have noted the Author of it. I am not one to take credit for other people's work. Anyway just go to AutoIt's Browse / Forum,,, and Enter this into Search: TxtFinderV512 Hopefully you will have no problem finding it. Last time I searched for it this way (02/08/25) only one result came up.... If you need help finding it just let me know... and if you do find it please run it... have a look inside the script... and as before your feedback would be much appropriated! P.S. If you open up the script in Windows (11) NotePad v11.2410.21.0 / Font: Consolas / Regular / 12 the code should line up good... and at least for me... should be easier to read through. Your Version of Window may not... but I hope it does.... -
You have two types of common arrays 1 dimensional array $aArray[Row Index#] example $aArray[0] $aArray[1] etc... 2 dimensional array $aArray[Row Index No.][Column Index No.] example $aArray[0][0] ;~ Row 0, Column 0 $aArray[0][1] ;~ Row 0, Column 1 $aArray[1][0] ;~ Row 1, Column 0 $aArray[1][1] ;~ Row 1, Column 1 So in your example you could use 2 dimensional array ;~ Keyname: In Excel this would be A1 $aArray[0][0] = "HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0" ;~ Valuename: In Excel this would be B1 $aArray[0][1] = "showInteractiveHelp" ;~ RegType: In Excel this would be C1 $aArray[0][2] = "REG_DWORD" ;~ RegData: In Excel this would be D1 $aArray[0][3] = "00000000" ;~ Keyname: In Excel this would be A2 $aArray[1][0] = "HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0" ;~ Valuename: In Excel this would be B2 $aArray[1][1] = "showWelcomeHint" ;~ RegType: In Excel this would be C2 $aArray[1][2] = "REG_DWORD" ;~ RegData: In Excel this would be D2 $aArray[1][3] = "00000000" etc... You can then use loop to iterate through the array for example: For $i = 0 To Ubound($aArray) - 1 ;~ Loop from index 0 to last row of the array RegWrite($aArray[$i][0], $aArray[$i][1], $aArray[$i][2], $aArray[$i][3]) Next