[snippet=]
GetWindowHandle>SM-G955U,nHandle
Let>WIN_USEHANDLE=1
GetWindowPos>nHandle,nXPos,nYPos
FindImagePos>C:\Users\MyUser\Documents\Macro Scheduler 14\FGLair Powerful (blast heat)\image_5.bmp,WINDOW:SM-G995U,0.4,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Endif
[/snippet]
I have a computer that I use just for smart home stuff. And one of the things that it does is it navigates an android application that controls a mini split heater.
In the example above, in the first three lines, I just wanted to prove that I could find the window handle for the android. That works correctly. And in the last few lines, it's supposed to find some image within that android window. But what ends up happening is, it recognizes the image within a chrome browser window instead.
I thought that supplying a WINDOW:title argument would constrain the image match to just the window, but it's not doing that. Can you tell me what I'm doing wrong? Would it be possible to supply a handle instead?
FindImagePos not staying within the WINDOW given
Moderators: JRL, Dorian (MJT support)
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Re: FindImagePos not staying within the WINDOW given
If it doesn't find the window it searches the entire screen.
I'm wondering if it could be one of these :
1: The window is not visible, cannot be captured and so you're getting a false positive. Try setting focus.
2: The window you're getting a false positive in is on top of the one you want.
3: The window title is changing or is incorrect.
I would add a SetFocus before your code and increase your tolerance to 0.7.
I'm wondering if it could be one of these :
1: The window is not visible, cannot be captured and so you're getting a false positive. Try setting focus.
2: The window you're getting a false positive in is on top of the one you want.
3: The window title is changing or is incorrect.
I would add a SetFocus before your code and increase your tolerance to 0.7.