Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/03/2022 in all areas

  1. Today, I will share my work with image search in inactive windows (windows that run in the background) with tolerances (variations). After a long time of searching and using image search UDF on the internet. I combined all of that with my experienced and created a UDF name HandleImgSearch. I have embedded the .dll file in this script so it doesn't need any external files, just include it and run. However, this UDF uses a pure AutoIT loop to make the multiple positions returned work so it may be slower if you set the $MaxImg to a high number. Some highlights: Very fast with imagesearchdll embedded, no external files required. Tolerances and Max Images are supported. Optimized. Use with a handle or full screen easily. Included global functions, so you can run multiple functions in one capture. Examples used for testing included. Notes: Only used to compile to 32-bit AutoIt version (It can completely run on Windows 64-bit) The image used for searching should be in a "24-bit Bitmap" format. I included the $IsUser32 variable in some places like _GlobalImgInit, _HandleCapture. This variable allowed you to use DllCall with the "PrintWindow" parameter instead of _WinAPI_BitBlt with $SRCCOPY. $IsUser32 = True is useful for the window explorer handle, $IsUser32 = False is useful for the emulator handle (NoxPlayer handle example included). If hwnd parameter equals "", it will use the whole screen instead. Functions: Global Functions: Run multiple functions with one capture. _GlobalImgInit: Initialization variables. _GlobalImgCapture: Capture the handle. _GlobalGetBitmap: Get captured bitmap handle. _GlobalImgSearch: This is the main function of this UDF. _GlobalGetPixel: Get pixel color in the captured image. _GlobalPixelCompare: Compare pixel color with captured image pixel color. Handle Functions: Capture every time. _HandleImgSearch: This is the main function of this UDF. Search for images in the handle of the window with the tolerance and maximum image options. _BmpImgSearch: Search the picture in the picture instead of the handle. _HandleGetPixel: Get pixel in the handle image. _HandlePixelCompare: Compare color with pixel color of handle image. _HandleCapture: Capture handle screen. Source code: v1.0.5 (First release): https://github.com/vnniz/HandleImgSearch/releases/tag/v1.0.5 v2.0.0 (14/04/2023): https://github.com/vnniz/HandleImgSearch/releases/tag/v2.0.0 Thanks to: ImageSearchDLL (Author: kangkeng 2008) MemoryCall (Author: Joachim Bauch) BinaryCall (Author: Ward) GAMERS - Asking for help with ANY kind of game automation is against the forum rules. DON'T DO IT.
    1 point
  2. Not that I know of. But you can easily create such a function yourself. Quick and dirty: $iPercent = 2 Global $iValue1 = 100 Global $iValue2 = 102 Global $iLowerBoundary = $iValue1 - ($iValue1/100*$iPercent) Global $iUperBoundary = $iValue1 + ($iValue1/100*$iPercent) if $iValue2 >= $iLowerBoundary And $iValue2 <= $iUperBoundary Then ConsoleWrite($iValue2 & " is 'equal' to " & $iValue1 & @CRLF) Else ConsoleWrite($iValue2 & " is NOT 'equal' to " & $iValue1 & @CRLF) EndIf
    1 point
  3. Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states: Moderation Team
    1 point
  4. @Musashi don't forget to fill your name when creating a ticket. I have updated the ticket with your name Cheers
    1 point
  5. I've managed to solve my problem by using Tesseract on very small screen regions. If I get all the table lines out of the image, Tesseract is quite good at recognition despite background color, etc. Luckily, in my application, once I know the location of a cell in the table, the other cell locations are just math. So I have a calibration function that allows the user to tweak coordinates using a sort of homebrew magnifier function.
    1 point
  6. @ARPFre you mean like this: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Global $Send Global $threshhold_upload, $threshhold_download, $average_download_speed, $average_upload_speed Global $objWMIServiceNTW = ObjGet("winmgmts:\\localhost\root\CIMV2"), $active_network_card, $Label1, $Label2, $Label5, $Label8 #Region ### START Koda GUI section ### Form= $gui = GUICreate("T3.0.01b", 1079, 663, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_MAXIMIZE, $WS_TABSTOP, $DS_MODALFRAME)) $RadioOn = GUICtrlCreateRadio("On", 208, 72, 33, 17) $RadioOff = GUICtrlCreateRadio("Off", 160, 72, 41, 17) $Label1 = GUICtrlCreateLabel("Download speed: ", 30, 665, 200, 15) $Label2 = GUICtrlCreateLabel("Max download speed:", 250, 665, 200, 15) $Label5 = GUICtrlCreateLabel("Upload speed: ", 30, 650, 200, 15) $Label8 = GUICtrlCreateLabel("Max upload speed:", 250, 650, 200, 15) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlCreateGroup("NetWork Active Info:", 15, 630, 835, 65) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $RadioOn $Send = '_on' ;detect the active network card $oSelect_active_network_cards = $objWMIServiceNTW.ExecQuery('Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True', "WQL") for $oSelect_active_network_card in $oSelect_active_network_cards $active_network_card = stringright($oSelect_active_network_card.Description, 6) ;get part of the name of the active network card Next $threshhold_download = 0 $threshhold_upload = 0 $average_download_speed = 0 $average_upload_speed = 0 case $RadioOff $Send = '_off' EndSwitch update_speeds() sleep(1) WEnd func update_speeds() ;get the download and upload speed $oNetwork_cards = $objWMIServiceNTW.ExecQuery("SELECT BytesReceivedPerSec, BytesSentPerSec FROM Win32_PerfFormattedData_Tcpip_NetworkInterface WHERE name LIKE '%" & $active_network_card & "%'", "WQL") For $oNetwork_card In $oNetwork_cards if $Send = '_off' Then GUICtrlSetData($Label1, "Real time download speed: ") GUICtrlSetData($Label5, "Real time upload speed: ") GUICtrlSetData($Label2, "Average download speed: ") GUICtrlSetData($Label8, "Average upload speed: ") Elseif $Send = '_on' Then $current_download_speed = Round($oNetwork_card.BytesReceivedPerSec / 1024) $current_upload_speed = Round($oNetwork_card.BytesSentPerSec / 1024) GUICtrlSetData($Label1, "Real time download speed: " & $current_download_speed & " kB/s") GUICtrlSetData($Label5, "Real time upload speed: " & $current_upload_speed & " kB/s") ;calculate the average download speed if $current_download_speed > $threshhold_download then $average_download_speed = Round(($current_download_speed + $average_download_speed) / 2) GUICtrlSetData($Label2, "Average download speed: " & $average_download_speed & " kB/s") EndIf ;calculate the average upload speed if $current_upload_speed > $threshhold_upload Then $average_upload_speed = Round(($current_upload_speed + $average_upload_speed) / 2) GUICtrlSetData($Label8, "Average upload speed: " & $average_upload_speed & " kB/s") EndIf EndIf Next EndFunc ;==>update_speeds
    1 point
  7. $hFile = FileOpen(@ScriptDir & "\WM_Messages.txt") is better Also, for the clueless ( me ), add the DMMDCore3.au3 code. Thanks for sharing
    1 point
×
×
  • Create New...