Imagesearch “group”?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Gargantilla

Imagesearch “group”?

17 Jan 2018, 17:21

Hello ladies and Gents,

I’m sorry if this has been asked before or if it’s actually a super simple question, but I was wondering if it’s possible to have a group of images be searched at once.

So let’s say I have Images A, B, and C. Is there a way I can make it so if none of Images A, B, or C is present, send [w] and if at least one of the images are present (it doesn’t matter if more or all of the images are present, there only needs to be one), send ?

Thanks.
User avatar
boiler
Posts: 16951
Joined: 21 Dec 2014, 02:44

Re: Imagesearch “group”?

17 Jan 2018, 19:25

Yes, depending on what you mean "at once." Just do several ImageSearch commands in a row, checking the value of ErrorLevel between each one. If any of them are present (ErrorLevel is 0), then set a flag (assign 1 to a variable named Found). After all of the searches, see if the flag is set, and either send [w] or depending on whether it is or not.
Gargantilla

Re: Imagesearch “group”?

17 Jan 2018, 21:42

boiler wrote:Yes, depending on what you mean "at once." Just do several ImageSearch commands in a row, checking the value of ErrorLevel between each one. If any of them are present (ErrorLevel is 0), then set a flag (assign 1 to a variable named Found). After all of the searches, see if the flag is set, and either send [w] or depending on whether it is or not.
So basically have all three imagesearches in a row (each on different lines and indented) and have each have an errorlevel = 0 to continue to the next imagesearch (until
all have been checked and it sends , or have an errorlevel = 1 to skip to the bottom of the script where I’ll send [w]?

Is there any way to make this code smaller? If I plan on adding more than Images A, B, and C I could see it getting very long.

Instead of:

Imagesearch Image A
If Errorlevel= 0
Continue
So on and so forth until send
If errorlevel = 1
Send [w]

Could I make it:

Imagesearch A, Imagesearch B, Imagesearch C
If Errorlevel= 0
Send,
If Errorlevel= 1
Send, [w]
User avatar
boiler
Posts: 16951
Joined: 21 Dec 2014, 02:44

Re: Imagesearch “group”?

18 Jan 2018, 08:44

Gargantilla wrote:So basically have all three imagesearches in a row (each on different lines and indented) and have each have an errorlevel = 0 to continue to the next imagesearch (until all have been checked and it sends , or have an errorlevel = 1 to skip to the bottom of the script where I’ll send [w]?

Is there any way to make this code smaller? If I plan on adding more than Images A, B, and C I could see it getting very long.

Instead of:

Imagesearch Image A
If Errorlevel= 0
Continue
So on and so forth until send
If errorlevel = 1
Send [w]

Could I make it:

Imagesearch A, Imagesearch B, Imagesearch C
If Errorlevel= 0
Send,
If Errorlevel= 1
Send, [w]
When you say "Instead of", that version doesn't work either. You haven't tried to implement what I said. Rather than explaining what's wrong with what you proposed, how about re-reading my reply and trying what I said?
Gargantilla

Re: Imagesearch “group”?

18 Jan 2018, 17:02

boiler wrote:
Gargantilla wrote:So basically have all three imagesearches in a row (each on different lines and indented) and have each have an errorlevel = 0 to continue to the next imagesearch (until all have been checked and it sends , or have an errorlevel = 1 to skip to the bottom of the script where I’ll send [w]?

Is there any way to make this code smaller? If I plan on adding more than Images A, B, and C I could see it getting very long.

Instead of:

Imagesearch Image A
If Errorlevel= 0
Continue
So on and so forth until send
If errorlevel = 1
Send [w]

Could I make it:

Imagesearch A, Imagesearch B, Imagesearch C
If Errorlevel= 0
Send,
If Errorlevel= 1
Send, [w]
When you say "Instead of", that version doesn't work either. You haven't tried to implement what I said. Rather than explaining what's wrong with what you proposed, how about re-reading my reply and trying what I said?
Alright will do, sorry

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww and 296 guests