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 .
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 continue without having found it.
The function "until found" is great , but it searches indefinatly .
[Mod note: This topic was eventually moved from “Ask for Help (v2)” since that section is for AHK help.]
Stop searching image
Moderator: Pulover
Re: Stop searching image
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.
Re: Stop searching image
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
Re: Stop searching image
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
Re: Stop searching image
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.
Re: Stop searching image
you seem to know things: can you answer how to break untilfound if NOT FOUND after a while in pulover, much appreciated
Re: Stop searching image
I don’t know anything about PMC.
-
- Posts: 107
- Joined: 12 Nov 2022, 15:47
Re: Stop searching image
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.