Jump to content

Application "Not Responding"

Recommended Posts

Hello Community, I am automating an thick application. One of the steps is to wait for a bitmap hash changed after an event, taking arbitrary amount of time. I use PixelChecksum to check if the hash is changed every second. It worked fine, but it occassionally breaks when the application is "Not Responding", which turns the front end grey. What kind of workarounds would you suggest? I appreciate any feedbacks and suggestions.

Link to comment
Share on other sites

Hi Alanchinese welcome to the forum. Based on you story you could build a time out into your script, so your app time outs instead of hanging.

It always helps if you post the relevant code in your thread (as long as applies to the forum rules). This way you get better directions and faster replies.

Link to comment
Share on other sites

Hi Wayfarer, the issue is not about the app is hanging. It says "Not responding" for a while, and return to normal when resource are available or it is not working that hard.

The issue is, the bitmap checksum changes when the app greys out. My code waits for a region of bitmap to change, i.e., "Processing...." is changed to "Completed". It still reads "Processing...", but the color is different.

Here is my function:

; $x, $y, $w, $h: region to check; $prepareRate: amount of milliseconds to skip on checking; $waitRate: amount of milliseconds between checks
Func _WaitForImageChanged($x, $y, $w, $h, $prepareRate, $waitRate)
   Local $checksum1 = PixelChecksum($x, $y, $w, $h)
   Local $checksum2 = $checksum1
   while $checksum1 = $checksum2
   $checksum2 = PixelChecksum($x, $y, $w, $h)
Link to comment
Share on other sites

Use WinGetState , wait for the state to be enabled (not busy/loading/working); prior to the pixel search

(use bitand)

1 = Window exists 2 = Window is visible 4 = Window is enabled 8 = Window is active 16 = Window is minimized 32 = Window is maximized

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Thank you jdelaney. I repeated the script overnight, it failed significantly less.

Now my follow up question is, how to wait for a specific image to appear?

I am wondering if there is a way for me to capture a target image's checksum and wait for this image to apear so my script can behave upon more than one results from a long running process.

I have seen PixelChecksum returning different results from different script executions. So the following code would not work.

For example

; Note: this function will not work as expected
; $x, $y, $w, $h: region to check; $prepareRate: amount of milliseconds to skip on checking; $waitRate: amount of milliseconds between checks
Func _WaitForImageToAppear($x, $y, $w, $h, $prepareRate, $waitRate)
  Local $count = 0
  While True
    Local $checksum = PixelChecksum($x, $y, $w, $h)
    Switch $checksum
      Case $targetImageCheckSum1
        Return 1
      Case $targetImageCheckSum2
        Return 2
      Case Else
        If $timeOut > 1000 Then
          Return 0
    $timeOut += 1
Edited by alanchinese
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...