Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keeping Macro Going during image find
#1
Hello! Great program so far, really easy to use!
My macros work, however it stops when it should be counting, not sure how to keep it going. also there is probably a better way to do this.

var w = wnd.find(0, "window name", "applicationname").Activate();
string primaryImage = @"image:"; //confirmation field y
string secondaryImage =  @"image:"; //popup button

int primaryImageCount = 0;

while (primaryImageCount < 6) {
    var primaryIm = uiimage.find(-1, w, primaryImage);

    if (primaryIm != null) {
        primaryImageCount++;
        keys.send("y"); // Primary image found, send "y".
    } else {
        // Primary image not found, let's look for the secondary image.
        var secondaryIm = uiimage.find(0, w, secondaryImage);

        if (secondaryIm != null) {
            // Secondary image found, you can close the popup or perform any other action.
            {secondaryIm.MouseClick();}
        }
    }
}

If I run the macro when the image is present it does the y button press, but will not automatically find it again when it pops up later.

What I am doing is a task that runs for about 1-2 minutes, once the task is completed, there is a button for the next step and you need to press y.
Sometimes there are popups during the task running, I just want to click that away so the task can continue and then look for the original image.
Each task has 6 steps to press y on, once those are completed it needs to wait for the file to save about 10 seconds and then start over again.

Thanks for any help you can provide!


Messages In This Thread
Keeping Macro Going during image find - by Stu - 11-08-2023, 11:48 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)