Problem with FindImagePos

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mrc
Newbie
Posts: 3
Joined: Fri Aug 14, 2015 11:52 am

Problem with FindImagePos

Post by mrc » Fri Aug 14, 2015 12:26 pm

Hi,

I have a script which runs fine on one laptop, but not working on another laptop. I have digged down the problem to display size. The function FindImagePos is returning wrong coordinates. But what is wrong?

I have tried to attach a little video showing my problem, but the file seems too big (86 MB). Is there way to send it to you? The video is showing a script created an run on the failing laptop (Samsung Ativ 9plus running windows 8.1). I'm running the latest macro scheduler (evaluation copy). As seen in the video the moment I use the "Image recognition wizard" in Macro Scheduler the display size suddenly changes and the icons are bigger and repositioned. I believe this to be the problem. As seen in the end of the video the coordinates of the captured icon on the original desktop reported by the macro scheduler itself is different than the ones in FindImagePos.

Macro Scheduler is reporting 115,128
FindImagePos is reporting 171,192

I have no special display application or anything running. It is pure Windows land we seems to be operating in.

Any Idears?

I have read some posts in this forum with similar issues, but without any solution.

Regards
Michael

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

Re: Problem with FindImagePos

Post by Marcus Tettmar » Fri Aug 14, 2015 3:10 pm

Is your display zoomed? There's a known issue if Windows is set to zoom objects at certain levels.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

mrc
Newbie
Posts: 3
Joined: Fri Aug 14, 2015 11:52 am

Re: Problem with FindImagePos

Post by mrc » Fri Aug 21, 2015 8:09 am

Hi Marcus,
Thanks for reply. It sounds like the right direction. Sorry to ask this, but how do I find out if it is zoomed?

You are not interested in seeing my video? :-)
(maybe it can clarify things)

Regards
Michael

mrc
Newbie
Posts: 3
Joined: Fri Aug 14, 2015 11:52 am

Re: Problem with FindImagePos

Post by mrc » Fri Aug 21, 2015 8:33 am

Hi,

I digged into it, and it seems my problem was that on the laptop which was not working the Text size setting was set to 150% as teh DEFAULT setting (!) (See attached screenshot). If I changed that to 100% FindImagePos worked.

But then it brings out another issue, which is my display icons are very small. It is not possible for the MacroScheduler to work on all windows settings conditions?

Regards
Michael

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

Re: Problem with FindImagePos

Post by Marcus Tettmar » Tue Aug 25, 2015 9:00 am

We are aware that 150% zoom causes issues for FindImagePos. At this stage we do not have a fix. Sorry.
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
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Problem with FindImagePos

Post by Grovkillen » Tue Aug 25, 2015 12:20 pm

I don't know if this is a doable work(around) but as I see it the reported find location is indeed correct but it doesn't take the DPI into the equation.

In order to know the zoom level just fetch the reg key for it and divide the result with 96 (default DPI is 96, thus 100%).

Code: Select all

RegistryReadKey>HKEY_CURRENT_USER,Control Panel\Desktop,LogPixels,CURRENT_DPI
Let>ZOOM_LEVEL={%CURRENT_DPI%/96*100}
MessageModal>Zoom level: %ZOOM_LEVEL% %
Let>ME=%Script%

Running: 15.0.24
version history

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

Re: Problem with FindImagePos

Post by Marcus Tettmar » Wed Sep 16, 2015 1:20 pm

Just to let you know that this issue (image recognition when windows zoom level is set higher than 100%) is now fixed in development and will be in the next maintenance release.
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
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Problem with FindImagePos

Post by Grovkillen » Wed Sep 16, 2015 3:26 pm

Great to hear that my idea got you going in the right direction on getting a fix! :wink:
Let>ME=%Script%

Running: 15.0.24
version history

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

Re: Problem with FindImagePos

Post by Marcus Tettmar » Thu Sep 17, 2015 10:13 am

Version 14.2.04 is now available with this fix.
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
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Problem with FindImagePos

Post by Grovkillen » Tue Oct 23, 2018 6:40 am

I have come to realize that the DPI / PixelsPerInch is causing problems with the current implementation of dialog creation. I develop on my main machine which is on 144DPI but then the dialog looks really messed up on 96DPI machines. I need to then take into account the DPI and create dynamic dialogs instead. Is there a way of getting the DPI as a system variable just like with USER_NAME and COMPUTER_NAME etc.? Or even better let the dialog handle the DPI automatically?

Today I use this to find DPI on both Win8 and Win10:

Code: Select all

  RegistryReadKey>HKEY_CURRENT_USER,Control Panel\Desktop,LogPixels,CURRENT_DPI
  If>CURRENT_DPI=
    RegistryReadKey>HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI,LogPixels,CURRENT_DPI
  Endif>
  MDL>CURRENT_DPI
Let>ME=%Script%

Running: 15.0.24
version history

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