Cant find image on second monitor

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
pikake069
Newbie
Posts: 3
Joined: Thu Jan 07, 2010 7:31 pm

Cant find image on second monitor

Post by pikake069 » Thu Jan 07, 2010 7:39 pm

OK, the script I made works as it should on my primary monitor. However, the second monitor will not get recognized even when same image is found on first monitor. Is there a way for image to be found on second monitor?


Thanks

Code: Select all


WSI_TIMEOUT = 0
label>start
FindImagePos>C:\Users\me\Desktop\macmbpm\wg4.bmp,SCREEN,17,1,X,Y,NumFound
If>NumFound>0
MouseMove>X_0,Y_0
LDOWN
wait>1
MouseMoveRel>425,180
wait>2
lclick>
endif
goto>start


pantik
Junior Coder
Posts: 45
Joined: Sun Dec 13, 2009 5:52 pm

Post by pantik » Thu Jan 07, 2010 10:14 pm

i tested that too. I have noticed that if you use "dualview" in the display setting, waitscreenimage only searchs in the primary monitor, however if you use extended desktop waitscreenimage will search in the 2 monitor. I am talking about nvidia graphics display.

pikake069
Newbie
Posts: 3
Joined: Thu Jan 07, 2010 7:31 pm

Post by pikake069 » Thu Jan 07, 2010 10:33 pm

so instead of FindImagePos use the waitscreenimage.. If i Do that how can I tell where the found image is at. Also my desktop duel view is already in the extended desktop mode.

Using W7 x64 with ATI 4800 Series card

pantik
Junior Coder
Posts: 45
Joined: Sun Dec 13, 2009 5:52 pm

Post by pantik » Thu Jan 07, 2010 11:02 pm

I tested it with waitscreenimage and i was guessing findimagepos works in the same way. I dont know ati display properties but you must chose the opcion that treat both monitor as a unique display i.e. you must see the task bar in both monitors.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Jan 08, 2010 10:17 am

At present the image recognition functions only work on the primary monitor.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Jan 08, 2010 11:12 am

I should add - that according to the Microsoft docs the way we have implemented it means that it SHOULD work on all monitors. But it only appears to work on the primary monitor. Could just be a case of the MS docs not being accurate. Either way I intend to find a solution.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Jan 08, 2010 12:25 pm

P.S. There is already a workaround. It is only when using SCREEN that the image recognition commands fail to look at the entire virtual display area and currently only look at the primary monitor. If, instead of SCREEN, you use ScreenCapture to capture a screen bitmap yourself you can capture the entire virtual area.

ScreenCapture can take the top left coords of your entire virtual screen area (usually 0,0 but could be negative if your primary monitor is NOT the left most one). If you don't know them beforehand the following code will capture it all:

Code: Select all

Let>SM_XVIRTUALSCREEN=76
Let>SM_YVIRTUALSCREEN=77
Let>SM_CXVIRTUALSCREEN=78
Let>SM_CYVIRTUALSCREEN=79

LibFunc>User32,GetSystemMetrics,VScrWidth,SM_CXVIRTUALSCREEN
LibFunc>User32,GetSystemMetrics,VScrHeight,SM_CYVIRTUALSCREEN
LibFunc>User32,GetSystemMetrics,VScrLeft,SM_XVIRTUALSCREEN
LibFunc>User32,GetSystemMetrics,VScrTop,SM_YVIRTUALSCREEN

ScreenCapture>VScrLeft,VScrTop,{%VScrWidth%+%VScrLeft%},{%VScrHeight%+%VScrTop%},%SCRIPT_DIR%\bmp1.bmp
Note I'm adding left and top offsets to width to get actual screen coordinates.

So that gives you a bitmap of the entire virtual screen area.

Now you can use that in FindImagePos. Of course you should add VScrLeft and VScrTop to the found positions to get actual screen positions for the case where the primary monitor is not on the left (the real position of top left could be negative whereas FindImagePos will return relative positions from 0,0).

So until we've implemented this internally you can use ScreenCapture to create the haystack instead of the 'SCREEN' parameter, if you need to work with multiple monitors.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

jwoo
Newbie
Posts: 1
Joined: Mon Jul 09, 2012 4:02 am

Post by jwoo » Mon Jul 09, 2012 4:07 am

Pls ignore - above code works...something else wrong with my code and I can't delete this post. Thanks.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts