|
Post by serdath on Aug 23, 2022 20:31:46 GMT
Hello there, I've been trying to put together a basic macro, but the truth is, i suck at this. So i hope someone here can help me figure out how to make it properly I had some progress but it isn't what i wanted, and i think the result was a mess, so i'd prefer making a clean new one First of all, i'd like the macro to check for two images, which i tried with detect image. In case of trying with only one image, it was all good, but i don't know how to set it up properly for 2 images. I only need one of the images to be found on the screen, but there can be multiple at once. In case at least one image is found, i would like the macro to click once at a given offset from the center of the image In case there is no such image on the screen, i just want the macro to click once at the given coordinates After these 2 steps, i want to check for another image, and in case it is on the screen, the macro will have to click once at the center of the image. In case there are multiple instances of that image, i'd like to have them all clicked, with a short delay between them. In case there's none, just continue with whatever other lines i will set up That's it. I would much appreciate a bit of help
|
|
|
Post by serdath on Aug 24, 2022 20:07:00 GMT
I actually managed to make it work, after all
|
|
|
Post by torikoko on Aug 25, 2022 4:14:24 GMT
Hi Serdath,
Post your Macro.
It might helps others with theirs.
|
|
|
Post by serdath on Aug 25, 2022 12:36:53 GMT
Hi Serdath, Post your Macro. It might helps others with theirs. Hi Torikoko, I still think my macro is a bit messy, but it does the trick for me due to the favorable circumstances 1 | RUN ACTION | MOUSE CLICK | Left click at 620 255 1 times with %RANDOM_850-950% ms delay 2 | IF | DETECT IMAGE | image path C:\Users\User\Desktop\Image1.bmp::match quick::move mouse yes: | IMAGE FOUND | GOTO MACRO LINE | 3 | ELSE | 2 | RUN ACTION | GOTO MACRO LINE | 4 3 | RUN ACTION | MOUSE CLICK | Left click at %mouse_x% %mouse_y% 1 times with 800 ms delay 4 | IF | DETECT IMAGE | image path C:\Users\User\Desktop\Image1.bmp::match quick::move mouse yes: | IMAGE FOUND | GOTO MACRO LINE | 5 | ELSE | 4 | RUN ACTION | GOTO MACRO LINE | 6 5 | RUN ACTION | MOUSE CLICK | Left click at %mouse_x% %mouse_y% 1 times with 800 ms delay 6 | IF | DETECT IMAGE | image path C:\Users\User\Desktop\Image2.bmp::at 783 347 59 628::match quick::move mouse yes::offset +490 0 | IMAGE FOUND | GOTO MACRO LINE | 8 | ELSE | 6 | RUN ACTION | GOTO MACRO LINE | 7 7 | IF | DETECT IMAGE | image path C:\Users\User\Desktop\Image3.bmp::at 783 347 59 628::match quick::move mouse yes::offset +490 0 | IMAGE FOUND | THEN 8 | RUN ACTION | MOUSE CLICK | Left click at %mouse_x% %mouse_y% 1 times with 400 ms delay 9 | IF | ELSE 10 | RUN ACTION | MOUSE CLICK | Left click at 1054 1000 1 times with 0 ms delay 11 | IF | END IF 12 | RUN ACTION | WAIT SECONDS | %RANDOM_178-182%
I changed the order a bit, so now it will first click a button which opens a page, where i want to check for an image, which might be in multiple instances, and click two of them (i don't know how to make it to click all existing ones with a short delay between them, so i wrote the code lines twice since clicking 2 instances is more than enough. Secondly, the macro will check if any of the two images (image2 and image3) are on the screen, if so, will click at an offset of 490 on x axis, from the first image it finds. If none is on the screen, it will click on a fixed location where there's a button. Sometimes this doesn't work properly and even if the images are found, it will still click on this fixed location, but it doesn't affect me because at that point the button will be locked. And the process will be repeated at random intervals between 178 and 182 seconds
|
|
|
Post by torikoko on Aug 26, 2022 0:53:27 GMT
This looks great! Well done serdath!
|
|
|
Post by serdath on Aug 26, 2022 7:08:25 GMT
I made a final version, where it will work fully consistent
1 | RUN ACTION | MOUSE CLICK | Left click at 620 255 1 times with %RANDOM_850-950% ms delay 2 | IF | DETECT IMAGE | image path C:\Users\User\Desktop\Image1.bmp::match quick::move mouse yes: | IMAGE FOUND | GOTO MACRO LINE | 3 | ELSE | 2 | RUN ACTION | GOTO MACRO LINE | 4 3 | RUN ACTION | MOUSE CLICK | Left click at %mouse_x% %mouse_y% 1 times with 700 ms delay 4 | IF | DETECT IMAGE | image path C:\Users\User\Desktop\Image1.bmp::match quick::move mouse yes: | IMAGE FOUND | GOTO MACRO LINE | 5 | ELSE | 4 | RUN ACTION | GOTO MACRO LINE | 6 5 | RUN ACTION | MOUSE CLICK | Left click at %mouse_x% %mouse_y% 1 times with 700 ms delay 6 | IF | DETECT IMAGE | image path C:\Users\User\Desktop\Image2.bmp::at 783 347 59 628::match quick::move mouse yes::offset +490 0 | IMAGE FOUND | GOTO MACRO LINE | 8 | ELSE | 6 | RUN ACTION | GOTO MACRO LINE | 7 7 | IF | DETECT IMAGE | image path C:\Users\User\Desktop\Image3.bmp::at 783 347 59 628::match quick::move mouse yes::offset +490 0 | IMAGE FOUND | GOTO MACRO LINE | 8 | ELSE | 7 | RUN ACTION | GOTO MACRO LINE | 10 8 | RUN ACTION | MOUSE CLICK | Left click at %mouse_x% %mouse_y% 1 times with 0 ms delay 9 | RUN ACTION | GOTO MACRO LINE | 11 10 | RUN ACTION | MOUSE CLICK | Left click at 1054 1000 1 times with 0 ms delay 11 | RUN ACTION | WAIT SECONDS | %RANDOM_178-182%
|
|