Stop searching image

Advanced Macro Recorder/Editor.

Moderator: Pulover

frab
Posts: 3
Joined: 16 May 2024, 18:06

Stop searching image

Post by frab » 16 May 2024, 18:47

If macro looks for image with "until found" how can you stop it looking indefinitely.

It should search for the image and continue as soon as possible when image is found :bravo: .

nonetheless, it should cancel the search automatically and continue (without finding the image) after unreasonably long time.


Basically: com'on macro, after one hour you didn't find it now :arrow: continue without having found it.

The function "until found" is great :bravo: , but it searches indefinatly :thumbdown:.


[Mod note: This topic was eventually moved from “Ask for Help (v2)” since that section is for AHK help.]
User avatar
boiler
Posts: 17374
Joined: 21 Dec 2014, 02:44

Re: Stop searching image

Post by boiler » 16 May 2024, 19:47

So you're asking how to change your macro script without posting it? Change line 7 to tell it to stop after it's been too long.
ntepa
Posts: 438
Joined: 19 Oct 2022, 20:52

Re: Stop searching image

Post by ntepa » 16 May 2024, 22:08

Here's an example of a loop that stops when image is found or 1 hour has passed:

Code: Select all

startTime := A_TickCount
loop {
    found := ImageSearch(   ) ; fill in your image search parameters
    elapsedTiime := A_TickCount - startTime
} until found || elapsedTiime > 3600000 ; 3600000 = 1 hour
frab
Posts: 3
Joined: 16 May 2024, 18:06

Re: Stop searching image

Post by frab » 17 May 2024, 00:45

boiler wrote:
16 May 2024, 19:47
So you're asking how to change your macro script without posting it? Change line 7 to tell it to stop after it's been too long.
Hello, :) I should mention that it's for Pulover and I'm a beginner and at Pulover a window pops up for scripting image search and it does NOT have a function SEARCH UNTILFOUND but abort after 1 minute (at least I don't find it).
It's stuck in SEARCH UNTILFOUND forever if it does not find it.

1|[Label]|first|0|Label||||||
...
78|Continue, Continue, FoundX, FoundY|20, 20, 20, 20, 0xF0F0F4, 0, Fast RGB|1|0|PixelSearch|UntilFound|Window||||

-----------------------------------------If pixel found script moves on; need to abort search after 5 minutes if not found (NOW IT'S STUCK FOREVER IN SEARCH) and do:

79|If Image/Pixel Not Found||1|0|If_Statement||||||
80|[Goto]|first|1|0|Goto||||||
81|[End If]|EndIf|1|0|If_Statement||||||
...

-----------------------------------------but if pixel was found script will move on anyway
User avatar
boiler
Posts: 17374
Joined: 21 Dec 2014, 02:44

Re: Stop searching image

Post by boiler » 17 May 2024, 02:30

Topic moved from the main section, since this is not looking for AHK help. The (vast) majority of helpers on this forum don’t use PMC. I’m not sure there is much help available from the PMC users or author either, but good luck.
frab
Posts: 3
Joined: 16 May 2024, 18:06

Re: Stop searching image

Post by frab » 17 May 2024, 02:49

boiler wrote:
17 May 2024, 02:30
Topic moved from the main section, since this is not looking for AHK help. The (vast) majority of helpers on this forum don’t use PMC. I’m not sure there is much help available from the PMC users or author either, but good luck.
you seem to know things: can you answer how to break untilfound if NOT FOUND after a while in pulover, much appreciated
User avatar
boiler
Posts: 17374
Joined: 21 Dec 2014, 02:44

Re: Stop searching image

Post by boiler » 17 May 2024, 03:37

I don’t know anything about PMC.
rockitdontstopit
Posts: 107
Joined: 12 Nov 2022, 15:47

Re: Stop searching image

Post by rockitdontstopit » 17 May 2024, 09:01

frab wrote:
16 May 2024, 18:47
It should search for the image and continue as soon as possible when image is found
[Mod note: This topic was eventually moved from “Ask for Help (v2)” since that section is for AHK help.]
Only use "repeat until found" if you know the image will be present. Otherwise use a loop with a defined number. Here I'm doing a 4 loop. If the image is found I break from the loop and then execute a left mouse click where the image was found. If the image is not found after 4 loops, nothing is done and the script finishes. Adjust delays and loop iterations based on how long and how frequently you want to execute searches.
imagesearchloop.png
imagesearchloop.png (71.5 KiB) Viewed 390 times
Post Reply

Return to “Pulovers Macro Creator”