GetRectCheckSum on extended monitor returns unexpected results

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

GetRectCheckSum on extended monitor returns unexpected results

Post by user5274 » Fri Jun 10, 2022 9:29 am

Using GetRectCheckSum on extended monitors returns unexpected results and always seems to return the same value no mater the bounding rectangle within the second monitor. As expected, use of GetRectCheckSum on the primary monitor works as intended.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: GetRectCheckSum on extended monitor returns unexpected results

Post by Dorian (MJT support) » Fri Jun 10, 2022 12:14 pm

I'm not able to replicate this in v15.0.20.

Assuming your coordinates are good (Bottom X should always be larger than Top X, Bottom Y should always be larger than Bottom Y), I wonder if Macro Scheduler isn't polling the 2nd monitor. This happens sometimes when a 2nd monitor is added when Macro Scheduler is already running. It happens rarely, but I have seen it happen. Does it resolve the issue if you restart Macro Scheduler?

Code: Select all

//2nd monitor (extended vertically)
GetRectCheckSum>1098,952,1860,1353,cs
put>cs

//cs:
//Chrome 2061424441
//File manager 2538076754
//Desktop 12701178079
Changing 1098 to 1078 returns different values as expected.
Yes, we have a Custom Scripting Service. Message me or go here

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: GetRectCheckSum on extended monitor returns unexpected results

Post by user5274 » Fri Jun 10, 2022 5:29 pm

I'll do more testing on this end.

For the results above I was using Win7, MS 15.0.19, and Y1=Y2, a horizontal line essentially. I'll try Y1 and Y2=Y1+1 instead. If that fails I'll try Win10.

Thanks for the tips.

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: GetRectCheckSum on extended monitor returns unexpected results

Post by user5274 » Sat Jun 11, 2022 3:06 am

Here is a test script, the desktop background was changed to Solid Red so the CRC should be equal.

This was compiled and tested on Win7 and Win10, MS 15.0.19b with the same results.

Other functions like GetPixel, WaitPixelColor, ScreenCapture all work fine when working with the secondary monitor

Code: Select all

//SETUP: solid RED color desktop, 2 monitors horizontal

GoSub>SampleCRC
Let>MSG=CRC of desktop background:%CRLF%
Let>MSG=%MSG%Monitor 1 %RESULT1% <-CRC of RED background%CRLF%
Let>MSG=%MSG%Monitor 2 %RESULT2% <-CRC of RED background%CRLF%%CRLF%
Let>MSG_HEIGHT=300
Let>MSG_WIDTH=400
MDL>MSG

RunProgram>notepad.exe
Wait>1

Let>WTITLE=Untitled - Notepad

//move notepad to monitor 1
MoveWindow>WTITLE,0,0
ResizeWindow>WTITLE,800,800
Wait>1
GoSub>SampleCRC
Let>MSG=%MSG%Notepad on Monitor 1:%CRLF%
Let>MSG=%MSG%Monitor 1 %RESULT1% <-CRC of Notepad WHITE background%CRLF%
Let>MSG=%MSG%Monitor 2 %RESULT2% <-CRC of RED background%CRLF%%CRLF%
MDL>MSG

//move notepad to monitor 2
MoveWindow>WTITLE,1920,0
Wait>1
GoSub>SampleCRC
Let>MSG=%MSG%Notepad on Monitor 2:%CRLF%
Let>MSG=%MSG%Monitor 1 %RESULT1% <-CRC of RED background%CRLF%
Let>MSG=%MSG%Monitor 2 %RESULT2% <-CRC of Notepad WHITE background%CRLF%%CRLF%
MDL>MSG

PutClipBoard>MSG

WindowAction>3,WTITLE

SRT>SampleCRC
  //monitor 1
  GetRectCheckSum>100,100,200,200,RESULT1
  //monitor 2 (horizontal to the right)
  GetRectCheckSum>{1920+100},100,{1920+200},200,RESULT2
END>SampleCRC

/*
CRC of desktop background:
Monitor 1 847766042 <-CRC of RED background
Monitor 2 847766042 <-CRC of RED background
  ^expected results
  
Notepad on Monitor 1:
Monitor 1 98279228 <-CRC of Notepad WHITE background
Monitor 2 98279228 <-CRC of RED background
  ^notepad open, why do CRCs match?
  
Notepad on Monitor 2:
Monitor 1 847766042 <-CRC of RED background
Monitor 2 847766042 <-CRC of Notepad WHITE background
  ^notepad open, why do CRCs match?
*/
The results seem to indicate that GetRectCheckSum is somehow mirroring the primary monitor
Dorian (MJT support) wrote:
Fri Jun 10, 2022 12:14 pm
This happens sometimes when a 2nd monitor is added when Macro Scheduler is already running. It happens rarely, but I have seen it happen. Does it resolve the issue if you restart Macro Scheduler?
The second monitor was always attached.
I did restart MS15
I did reboot the PC
This did not resolve the unexpected results

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: GetRectCheckSum on extended monitor returns unexpected results

Post by user5274 » Thu Jun 16, 2022 9:40 pm

Bumping

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: GetRectCheckSum on extended monitor returns unexpected results

Post by Dorian (MJT support) » Fri Jun 17, 2022 9:55 am

I was out of ideas on this so asked Marcus. He has asked if the settings are different on the second monitor? (different resolutions, colour depths etc).
Yes, we have a Custom Scripting Service. Message me or go here

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: GetRectCheckSum on extended monitor returns unexpected results

Post by user5274 » Fri Jun 17, 2022 10:08 am

Same brand monitor, same resolution, same color depth, and most importantly the same color profiles (no profile).

The script above can be easily run if you have a solid color desktop background and horizontally placed monitors.

Thanks

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