Leaderboard
Popular Content
Showing content with the highest reputation on 01/07/2022 in all areas
-
That's fine for professionals, which for obvious reasons is not the focal group for this website. I use both the Free version of Visual Studio, for SciTE4AutoIt3 development and other projects I work on as hobbyist, and use VSCODE together with PlatformIO for development of ESP32/ESP8266 projects and must say that VSCODE is a pretty nice free editor that will do quite well for the majority of our audience. So maybe you really need to think about what you post before burping your expert opinion in these thread. ... but hey .... who am I to say all of this as I am indeed a simple hobbyist.2 points
-
Version 2025.5.25.5
11,373 downloads
High-Performance ImageSearch UDF & DLL for AutoIt This project provides a highly optimized UDF (User Defined Function) and two versions of a DLL (Dynamic-Link Library) for fast and flexible image searching on the screen using AutoIt. It serves as a powerful replacement for standard image search functions, delivering superior speed, especially on modern CPUs, by leveraging advanced SIMD instructions. ✨ Key Features Superior Speed: The modern version utilizes the AVX2 instruction set to accelerate the search speed by several factors compared to traditional methods. Two DLL Versions: Provides both a modern version (optimized for speed) and a legacy version (for Windows XP support). Multi-Image Search: Search for multiple image files in a single function call by separating paths with a pipe (|). Multi-Scale Searching: Automatically search for an image across a range of sizes (e.g., from 80% to 120% of its original size). Color Tolerance: Find images even with slight color variations by setting a tolerance value (0-255). Transparent Color Support: Specify a color in the source image to be ignored during the search. Flexible Result Handling: Find and return the first match. Find and return all matches on the screen. Limit the maximum number of results. Smart (Hybrid) DLL Loading: The UDF prioritizes an external DLL for maximum performance and automatically falls back to an embedded DLL to ensure the script always runs. Unicode Support: Works flawlessly with file paths containing Unicode characters. Thread-Safe: The DLL is designed to operate stably in multi-threaded scenarios. Debug Information: Provides an option to return a detailed debug string for easy troubleshooting. 🚀 The Two DLL Versions The project offers two DLL versions to meet different needs: 1. ImageSearch_x86.dll ImageSearch_x64.dll (Modern Version) (Attached in the same UDF folder - Because the DLL file with AVX2 support is large in size) This is the recommended version for most users. Strengths: AVX2 Support: Leverages Advanced Vector Extensions 2 on modern CPUs to process multiple pixels in parallel, resulting in extremely fast search speeds. Built with modern C++, ensuring stability and efficiency. Limitations: Not compatible with Windows XP. When to use: When you need maximum performance on Windows 7, 8, 10, 11, and newer. 2. ImageSearch_XP.dll (Legacy Version) (Embedded in UDF code) This version is created for backward compatibility. Strengths: Windows XP Compatibility: Works well on the Windows XP (SP3) operating system. Limitations: No AVX2 Support: Search speed will be significantly slower than the modern version on AVX2-supported CPUs. When to use: When your script must run in a Windows XP environment. ⚙️ How the UDF Works The ImageSearch_UDF.au3 file uses a very smart "hybrid" DLL loading mechanism: Prioritize External DLL: When the _ImageSearch function is called, the UDF first looks for ImageSearch_x86.dll and ImageSearch_x64.dll in the same directory as the script (@ScriptDir). If found, it uses this file to achieve the best performance (with AVX2 if available). Fallback to Embedded DLL: If the external DLL is not found, the UDF will automatically extract and use a legacy (non-AVX2) compatible DLL version that is embedded within it as a hex string. ➡️ This ensures that your script can always run, even if you forget to copy the DLL file. However, for the highest speed, always place the modern ImageSearch_x86.dll and ImageSearch_x64.dll next to your script. 📦 Setup Place the DLL file: Copy ImageSearch_x86.dll and ImageSearch_x64.dll (the modern version) into the same directory as your AutoIt script file. Include the UDF in your script: Use the line #include <ImageSearch_UDF.au3> in your script. 📖 API Reference The main function for performing an image search. _ImageSearch($sImageFile, [$iLeft = 0], [$iTop = 0], [$iRight = 0], [$iBottom = 0], [$iTolerance = 10], [$iTransparent = 0xFFFFFFFF], [$iMultiResults = 0], [$iCenterPOS = 1], [$iReturnDebug = 0], [$fMinScale = 1.0], [$fMaxScale = 1.0], [$fScaleStep = 0.1], [$iFindAllOccurrences = 0]) Parameters Parameter Type Default Description $sImageFile String - Path to the image file. To search for multiple images, separate paths with a pipe (` $iLeft Int 0 The left coordinate of the search area. 0 defaults to the entire screen. $iTop Int 0 The top coordinate of the search area. 0 defaults to the entire screen. $iRight Int 0 The right coordinate of the search area. 0 defaults to the entire screen. $iBottom Int 0 The bottom coordinate of the search area. 0 defaults to the entire screen. $iTolerance Int 10 Color tolerance (0-255). A higher value allows for greater color variation. $iTransparent Int 0xFFFFFFFF The color (in 0xRRGGBB format) to be ignored in the source image. 0xFFFFFFFF means no transparency. $iMultiResults Int 0 The maximum number of results to return. 0 means no limit. $iCenterPOS Bool 1 (True) If True, the returned X/Y coordinates will be the center of the found image. If False, they will be the top-left corner. $iReturnDebug Bool 0 (False) If True, the function returns a debug string instead of the results array. $fMinScale Float 1.0 The minimum scaling factor for the search (e.g., 0.8 for 80%). Must be >= 0.1. $fMaxScale Float 1.0 The maximum scaling factor for the search (e.g., 1.2 for 120%). $fScaleStep Float 0.1 The increment to use when searching between min and max scales. Must be >= 0.01. $iFindAllOccurrences Bool 0 (False) If False, the search stops after the first match. If True, it finds all possible matches. Return Value On Success: Returns a 2D array containing the coordinates of the found images. $aResult[0][0] = The number of matches found. $aResult[1] to $aResult[$aResult[0][0]] = An array for each match. $aResult[$i][0] = X coordinate $aResult[$i][1] = Y coordinate $aResult[$i][2] = Width of the found image $aResult[$i][3] = Height of the found image On Failure / No Match: Sets @error to 1 and returns 0. In Debug Mode: If $iReturnDebug is True, returns a string containing detailed information about the last search operation. 💻 Examples Example 1: Basic Search Find the first occurrence of button.png on the screen. #include <ImageSearch_UDF.au3> Local $aResult = _ImageSearch("C:\images\button.png") If @error Then MsgBox(48, "Error", "Image not found on screen.") Else Local $iCount = $aResult[0][0] Local $iX = $aResult[1][0] Local $iY = $aResult[1][1] MsgBox(64, "Success", "Found " & $iCount & " image(s). First match is at: " & $iX & ", " & $iY) MouseMove($iX, $iY, 20) ; Move mouse to the center of the found image EndIf Example 2: Advanced Search (Multiple Images, Tolerance, Scaling) Search for icon1.png or icon2.png within a specific region, with a tolerance of 20 and scaling from 90% to 110%. Find all occurrences. #include <ImageSearch_UDF.au3> Local $sImages = "icon1.png|icon2.png" Local $iTolerance = 20 Local $fMinScale = 0.9 Local $fMaxScale = 1.1 Local $fStep = 0.05 Local $aResult = _ImageSearch($sImages, 500, 300, 1200, 800, $iTolerance, 0xFFFFFFFF, 0, True, False, $fMinScale, $fMaxScale, $fStep, True) If @error Then MsgBox(48, "Error", "No matching images found in the specified region.") Else Local $iCount = $aResult[0][0] ConsoleWrite("Found " & $iCount & " total matches." & @CRLF) For $i = 1 To $iCount ConsoleWrite("Match #" & $i & ": X=" & $aResult[$i][0] & ", Y=" & $aResult[$i][1] & ", W=" & $aResult[$i][2] & ", H=" & $aResult[$i][3] & @CRLF) Next EndIf Example 3: Using Debug Mode To diagnose issues, use the $iReturnDebug parameter. #include <ImageSearch_UDF.au3> Local $2dDLLResult = _ImageSearch("image_not_exist.png", 0, 0, 0, 0, 10, 0xFFFFFFFF, 0, True, True) ConsoleWrite(">> DLL Return: " & $g_sLastDllReturn & @CRLF) ; Example output: {0}[No Match Found] | DEBUG: File=image_not_exist.png, Rect=(0,0,1920,1080), Tol=10, Trans=0xffffffff, Multi=0, Center=1, FindAll=0, AVX2=true, Scale=(1.00,1.00,0.10) SPECIAL NOTE: The function always returns a 2D array for both results and errors. Credits Author: Dao Van Trong - TRONG.PRO Source Dll on GitHub: daovantrong/ImageSearchDLL: A DLL for finding an image on the screen1 point -
I've ported some of the JavaScript 140 Bytes demos from dwitter.net to FreeBasic. Download AiO with 1000 examples (7-Zip archive): The beauty - magic of math Vol. 1 - 23 build 2024-01-14.7z (5.09 mb with source code and Windows x64 compiled executables) or have a look to my 1drive folder: _dwitter.net Some screenshots: ... Autoit is too slow for almost all of these examples. Happy watching.1 point
-
Thanks for that you back with answer which capability setting solves your issue.1 point
-
@mLipok This one below fixed the problem. I was adding them one at a time and removing the others. I will keep this list for future use as I write a lot of other scripts. Thanks VERY much for the quick response. @Danp2, thanks for your help as well. You guys are awesome. _WD_CapabilitiesAdd('args', '--disable-web-security')1 point
-
2022 updates for Autoit
junkew reacted to argumentum for a topic
it looks nice. That said: the paths are hard coded full path and what I do is run any version of AutoIt in portable SciTE(s). Just decompress anywhere and run the environment. So if running say, production and beta with relative paths then VSCode could be something interesting to look at for me. Also, the checker and tidy are from the SciTE distribution, so is not a replacement for SciTE distribution. On the other hand, maintaining utilities, is less than utilities and the editor too. My 2 cents. I don't wanna start a tug war.1 point -
Thank you Junkew It worked with the controltype criteria ! $oDocument = _UIA_getFirstObjectOfElement($oChrome, "controltype:=" & $UIA_DocumentControlTypeId, $treescope_subtree) If Not IsObj($oDocument) Then _UIA_DumpThemAll($oChrome, $treescope_subtree) Else $t = StringSplit(_UIA_getPropertyValue($oDocument, $UIA_BoundingRectanglePropertyId), ";") _UIA_DrawRect($t[1], $t[3] + $t[1], $t[2], $t[4] + $t[2]) EndIf Sleep(500) $oSavePlease = _UIA_getObjectByFindAll($oDocument, "name:=SAUVEGARDER;controltype:="& $UIA_HyperlinkControlTypeId, $treescope_subtree) If Not IsObj($oSavePlease) Then _UIA_DumpThemAll($oDocument, $treescope_subtree) ConsoleWrite("Test") Else _UIA_action($oSavePlease, "invoke") EndIf So the summary : The problem was due to two occurences of the same name in the treescope. It was discovered thanks to the "FindThemAll" function. The script was always calling the first one, which was the wrong one. By using the Spytool, the difference between the two objects became apparent. The two object had for example a different controltype. Adding the controltype criteria has thus allowed to target the right object. "name:=SAUVEGARDER;controltype:="& $UIA_HyperlinkControlTypeId The button is now correctly targeted and can be invoked. Thank you very much Junkew !1 point
-
Sorry syntax is with a semicolon ;~ _UIA_setVar("MACH3.mnuFile","name:=((File)|(Bestand));index:=2") First get it debugged with findthemall modification's like if _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)="SAUVEGARDER" then consolewrite(_UIA_getAllPropertyValues($UIA_oUIElement) & @CRLF) endif Integrated like below Func findThemAll($oElementStart, $TreeScope) Local $hTimer = TimerInit() ;~ Get result with findall function alternative could be the treewalker Dim $pCondition, $pTrueCondition Dim $pElements, $iLength $UIA_oUIAutomation.CreateTrueCondition($pTrueCondition) $oCondition = ObjCreateInterface($pTrueCondition, $sIID_IUIAutomationCondition, $dtagIUIAutomationCondition) ;~ $oCondition1 = _AutoItObject_WrapperCreate($aCall[1], $dtagIUIAutomationCondition) ;~ Tricky to search all descendants on html objects or from desktop/root element $oElementStart.FindAll($TreeScope, $oCondition, $pElements) $oAutomationElementArray = ObjCreateInterface($pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray) $oAutomationElementArray.Length($iLength) For $i = 0 To $iLength - 1; it's zero based $oAutomationElementArray.GetElement($i, $UIA_pUIElement) $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) ConsoleWrite("Title is: " & _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) & @TAB & "Class=" & _UIA_getPropertyValue($oUIElement, $uia_classnamepropertyid) & @CRLF) if _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)="SAUVEGARDER" then $t = StringSplit(_UIA_getPropertyValue($oUIElement, $UIA_BoundingRectanglePropertyId), ";") _UIA_DrawRect($t[1], $t[3] + $t[1], $t[2], $t[4] + $t[2]) consolewrite(_UIA_getAllPropertyValues($UIA_oUIElement) & @CRLF) endif Next Local $fDiff = TimerDiff($hTimer) Consolewrite("Findthemall took: " & $fDiff & " milliseconds" & @CRLF & @CRLF) EndFunc ;==>findThemAll1 point
-
Please put the code in coding tags to keep it readable Just run a lengthy dump first from your whole page and then see if the name is not there multiple times findThemAll($oChrome, $treescope_subtree) findThemAll is just a function helpfull for debugging so you have to extend/customize to your own need. It looks like it finds the element so you could add in the for/next loop if _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)= "SAUVEGARDER" then $t = StringSplit(_UIA_getPropertyValue($oUIElement, $UIA_BoundingRectanglePropertyId), ";") _UIA_DrawRect($t[1], $t[3] + $t[1], $t[2], $t[4] + $t[2]) endif Is there any way to directly get the coordinates from an object created with _UIA_getObjectByFindAll ? yes, see above how to get the bounding rectangle so it becomes something like below $oUIElement=_UIA_getObjectByFindAll(..... $t = StringSplit(_UIA_getPropertyValue($oUIElement, $UIA_BoundingRectanglePropertyId), ";") _UIA_DrawRect($t[1], $t[3] + $t[1], $t[2], $t[4] + $t[2])1 point
-
2022 updates for Autoit
markyrocks reacted to HurleyShanabarger for a topic
1 point -
I honestly do not care about how you interpret my posts and for sure are't trying to get into a pissing contest with you. My posts are simply an other opinion to counter your strong opinion ,which in my humble view are pretty "colored". I leave it to the readers to filter the information that they are interested in. over and out1 point
-
have the user supply it beforehand, something like: $sName = inputbox('put yer name here'......... $CMD = 'New-psDrive ' & $sName1 point