Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Possible to scan for multiple images at once?
#1
Is it possible to scan for multiple images at once (maybe by use of threading) and priorize certain images over others?
If so, could someone please help me with a little example? I only know how to use basic beginner code.
If it doesnt work with LibreAutomate, does it work with QM?
#2
In the "Find image..." tool capture an image and click More -> Add to array. Then capture more images. It will create code like this.

Code:
Copy      Help
var w = wnd.find(1, "name", "class");
IFImage[] image = {
    @"image:",
    @"image:",
};

var im = uiimage.find(1, w, image);
im.MouseMove();

uiimage.find does not use multiple threads. Probably it would not make much faster. The slow part usually is getting screen pixels.
#3
Thank you! I will try that.

Your answer brings me to an idea. Would it be possible to automatically take a screenshot (in the background) and get the pixels from there with threads?
Maybe the screenshot could be scraped by each thread then. Would this be faster?
#4
Usually the slowest part is taking a screenshot (aka "screen pixels"). But the "find" part can be slower if there are many images in the array; then multiple threads could make faster. I tested it, but it does not work, because uiimage.find locks the bitmap and other threads can't access it.
#5
Thank you for testing it! Do you think it would be possible to save copies of the screenshot for each thread? If i loose one or two seconds for this to gain 8 or 16 times faster scan time this would make scanning so much faster. I imagine a tool that automatically makes screenshots, copies them for each thread and updates or replaces them after all threads finished one scan loop.

Maybe it would be possible to even have 2 scans for each thread and they are fast enough to notice if something changed after a few seconds? It would be so awesome if this works!

Edit: No pressure. Its just an idea. Im not a Programmer but i know that programming with threads is not that easy.
#6
Possible, but not thread-safe, and not the fastest way.

In next program/library version uiimage.find can search in multiple threads. Use flag IFFlags.Parallel. Can by 2-3 times faster when there are many images.
#7
Thats cool! Im really curious how this behaves when i use it. Thank you!


Forum Jump:


Users browsing this thread: 3 Guest(s)