Jump to content

Win 11 upgrade stops script with pixelchecksum()

Recommended Posts

Hi Guys

Long time since I have needed to ask for any help, great!

I have a script I use to read a big file it has many elements, first I open the script, it reads the file and creates a dropdown list all fine on my old laptop and all fine on this new one with win 11, I select the title from this dropdown/list and hit go to get my result, it all works fine.

On my old laptop I made another tool to select each item, hit go, wait for the result then select the next list title and hit go, wait for result, rinse and repeat as I wanted certain elements to be written to a file so I could peruse later, I used pixelchecksum to monitor an area and continue when change happens.

Func goforit()

         If $i = 0 Then; just click start
            MouseClick("left", 1400,68)

         $iCheckSum = PixelChecksum(1265, 118, 1300, 129)
            While $iCheckSum = PixelChecksum(1265, 118, 1300, 129);wait for change

         MouseClick("left", 1125,66; select title box
         MouseClick("left", 1400,68); click start

      $i = $i+1

      Until $i = GUICtrlRead($titles)-1

      ;self close
      MouseClick("left", 1012,470)


The tool clicks Go then waits ....... and waits, I see the change but it doesn't, any idea why?

Thanks in advance as always.

Sorry Mods, please move thread

Edited by Phaser
wrong forum category, sorry guys
Link to comment
Share on other sites

  • Developers

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:


General development and scripting discussions.

Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

Link to comment
Share on other sites

  • Phaser changed the title to Win 11 upgrade stops script with pixelchecksum()

Yeah did think that, however I use the window info tool, mouse click x&y are the same so are the pixelchecksum coordinates as the tool moves to the Go button and wait position, I am using the x64 tool should I use the x86 for checksum?

Link to comment
Share on other sites

Something that may change how it works or where it's searching is Windows Display Scaling, is your display scaling set to 100%, or something more (which could throw things off)? Check out the support page on it: https://support.microsoft.com/en-us/windows/view-display-settings-in-windows-37f0e05e-98a9-474c-317a-e85422daa8bb

Otherwise, I'd recommend adding some logging and doing some tests like @ioa747 has set up. Test in 100x100 blocks or larger like that, and make sure that you're able to search/check across the whole screen, or if it starts jumping (because of scaling) or certain areas are unavailable (possibly some type of UAC/permissions level issue).

Here's a basically automatic test I made (partially on accident):

#include <WinAPI.au3>
#include <WinAPIGdiDC.au3>
#include <WinAPIGdi.au3>
#include <WinAPIHObj.au3>
#include <WindowsConstants.au3>
#include <WinAPISysWin.au3>

Global $iChecksum = PixelChecksum(0, 0, 100, 100)
__cLog('Starting checksum = ' & $iChecksum)
Global $iNewChecksum
For $iY = 0 To @DesktopHeight Step 100
    For $iX = 0 To @DesktopWidth Step 100
        __cLog('Searching new location: ' & $iX & ', ' & $iY & ' --> ' & $iX + 100 & ', ' & $iY + 100)
        $iChecksum = PixelChecksum($iX, $iY, $iX + 100, $iY + 100)
        __cLog('New location checksum = ' & $iChecksum)
;~          _WinAPI_DrawRect($iX - 3, $iY - 3, $iX + 103, $iY + 103, 0x0000FF) ; This should allow mostly for manual testing
            _WinAPI_DrawRect($iX, $iY, $iX + 100, $iY + 100, 0x0000FF) ; This will trigger and automated test, since it'll change the checksum
            $iNewChecksum = PixelChecksum($iX, $iY, $iX + 100, $iY + 100) ; Search for change
            If $iNewChecksum = 0 Then
                __cLog('Error with PixelChecksum')
        Until $iChecksum <> $iNewChecksum Or Not _Sleep(15)
        __cLog('    Checksum changed = ' & $iNewChecksum)

Func __cLog($sMsg)
    Local Static $sPrevMsg ; Used to prevent spamming the same message

    If $sMsg == $sPrevMsg Then
        Return False

    ConsoleWrite($sMsg & @CRLF)
    $sPrevMsg = $sMsg

    Return True
EndFunc   ;==>__cLog

Func _Sleep($iMs)
    Return True
EndFunc   ;==>_Sleep

Func _WinAPI_DrawRect($start_x, $start_y, $iWidth, $iHeight, $iColor)
    Local $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
    Local $tRect = DllStructCreate($tagRECT)
    DllStructSetData($tRect, 1, $start_x)
    DllStructSetData($tRect, 2, $start_y)
    DllStructSetData($tRect, 3, $iWidth)
    DllStructSetData($tRect, 4, $iHeight)
    Local $hBrush = _WinAPI_CreateSolidBrush($iColor)

    _WinAPI_FrameRect($hDC, DllStructGetPtr($tRect), $hBrush)

    ; clear resources
    _WinAPI_ReleaseDC(0, $hDC)
EndFunc   ;==>_WinAPI_DrawRect


We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

Thanks guys, I setup a _ScreenCapture_Capture() to see where it was looking and then set the scaling to 100% all is fine now, although, I have a write to file line that does work but I have to close and then re-open the txt file to see the entries, old laptop I could just click off then back on to the editor window and it would show the lines written so far, so as you can guess I was thinking it wasn't writing for some time. Not a big issue. Thanks again.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...