Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find image - DO based on what image found

Basically what I am trying to do is,

1. I have 4 different images

2. I want it to paste a text based on what image it finds on my screen

For example,

If finds image 1 and paste text 1,
or If it finds image 2, paste text 2,

Hope someone can help!

Thanks in advance!
Macro Macro6
Select All      Help
int w=win
int i=scan("image:h43312EF0[]image:h65F5BD95[]image:h2FC19D26" w 0 0)
sel i
,case 0: out "not found"
,case 1: paste "one"
,case 2: paste "two"
,case 3: paste "three"
Thanks a lot!

One more thing,
I also want this to happen:

If BOTH image 1 and image 2 is on the screen, execute case 3

How can I make this happen?

Looking forward to your help!
Use flag 0x800. Read more in scan Help.
Or scan 2 times - for image 1 and 2 separately.
I am using this macro on images found in Bluestacks to trigger an action, but unfortunately the code does not recognize the image I have captured with QM every time, only sometimes..
If finds only sometimes, maybe the object is partially transparent, mixed with background. Then does not find when background changes. Try "Allowed color difference", for example 50.
So its like this,

I'm trying to find a blue chat dialogue with a specific text which will everytime appear at different position on the screen everytime it shows.
And setting allowed color difference to 50, 100, or 150 doesnt work no matter value.

I have to mention it works the first time as I set the image capture and run but then the second time when the chat dialogue shows and is now on a different position, it doesnt find it. (same image on screen can be seen but just different position)

My Code:
int w1=act(win("BlueStacks" "HwndWrapper[Bluestacks.exe;*"))
int i=scan("image:hBE274FE7" w1 0 0)
sel i
case 0: mac "Message 1"
case 1: mac "Message 2"
Screenshots of both text versions may help to find a solution or to improve the scan function in the future.

Forum Jump:

Users browsing this thread: 1 Guest(s)