This topic is now closed to further replies.
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 have a feature that will make it run slower is $MaxImg variable, this variable will allow you to return multiple positions of a finding image.
Very fast with imagesearchdll embedded, no external files required. Tolerances and Max Images are supported. Optimized. Use with handle or full screen easily. Included global functions, so you can run multiple functions in one capture. Examples used for testing included. Notes:
Image use for searching should be a "24-bit Bitmap" format. I included $IsUser32 variable in some places like _GlobalImgInit, _HandleCapture. This variable allowed you to use DllCall with "PrintWindow" parameter instead of _WinAPI_BitBlt with $SRCCOPY. $IsUser32 = True is useful for window explorer handle, $IsUser32 = False is useful for the emulator handle (NoxPlayer handle example included). If hwnd parameter equal "", it will use hold 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 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 picture in picture instead of handle. _HandleGetPixel: Get pixel in handle image. _HandlePixelCompare: Compare color with pixel color of handle image. _HandleCapture: Capture handle screen. Source code: https://github.com/ltnhanst94/HandleImgSearch
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.
Maybe you can help me with something small.
It is not terrible but it slows down my script and after a while even crash the script.
First i explain what i have;
I have a GUI with a lot of GUICtrlCreateInput controls, lets say 600 pieces.
All the controls are hidden when the GUI is displayed, i have 3 buttons attached to 200 pieces each.
When i press button-1 the first 200 controls are showed,
When i press button-2 the first 200 controls are hidden and the next 200 controls are showed,
This is working perfectly but after a while the GUI is getting slower and slower.
After a while the controls aren't responding anymore and the script crashes.
When i compile the script to 64-Bits version the speed is a lot better but you can still see the script slowing down each time i use the buttons.
I think there has to be a buffer somewhere that is filling each time i show and hide the controls, but how can i clear that buffer without restarting the script?
Deleting and re-creating the controls didn't help, deleting the entire gui (and controls) and re-creating it didn't help also.
The only thing that is working is restarting the script.
PS: If you need a working example i can add it to this topic, just let me know. It is not rocket science, i just create the controls and show/hide them with a while loop and 3 buttons.
I know the title sounds weird, but i couldn't find better words for it...
I finally managed to have a working image search (yes yes i know image search is evil :p).
I noticed that even if the script is compiled, the images have to be in my script folder.
But i don't want that the images i'm searching for on the screen can be viewed, edited etc by every user.
Is there a way to... uhm... put them in a file like .rar, but one that can't be easily opened? 🤔
Edit: Now that i think of .rar, maybe using a .rar which is protected by a password... Can autoit search, open, extract, use and delete that? (I guess so, I didn't search for this yet, going to google that asap)