Sign in to follow this  
Followers 0
kamyers1

Detecting "Ready" in StatusBarWnd20Class

8 posts in this topic

Ok, a more intelligent question than my last post (sorry about that one)...

I am attempting to control an application where I need to detect when a certain action that requires very substantial execution time has completed. The amount of time required may vary from a few seconds to several hours. I need to detect when this long-winded action has completed so that I know when the application is ready to execute further actions. The appearance of "Ready" in the status bar is the only consistent indication in the application that I have noted which shows when the long-winded action has completed. This action does not produce any external files or any other effects external to the application that could be detected to my knowledge.

The application doesn't appear to effectively buffer keystrokes or mouse actions while the long-winded action is executing, so I can't simply attempt to execute addtional actions without waiting for the long winded action to complete. And I can't simply pause script execution while the long-winded action completes due to the extreme variability in the amount of time that may be required.

AutoIt Window Info detects the status bar and identifies it to be a StatusBar20WndClass control, but it doesn't report any text for either the status bar or the control. Can someone advise how I may be able to detect the appearance of "Ready" in this control?

Thanks,

Kevin M.

Share this post


Link to post
Share on other sites



You can try this (requires PaulIA's AU3 Library):

#include <A3LStatus.au3>
Opt("WinTitleMatchMode", 4)

$WinTitle = "Fix Me!"
$hWin = WinGetHandle($WinTitle, "")
$hStatus = ControlGetHandle($hWin, "", "[Class:StatusBar20WndClass]")
$avStatusParts = _Status_GetParts ($hStatus)
$sMsg = ""
For $n = 0 To $avStatusParts[0] - 1
    $sMsg &= $n & ": " & _Status_GetText ($hStatus, $n) & @CRLF
Next
MsgBox(64, "Results", "Text From Status Bar Parts:" & @CRLF & $sMsg)

Without the app, or one with the same type of status bar, I can't test it.

Hope that helps.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You can try this (requires PaulIA's AU3 Library):

#include <A3LStatus.au3>
Opt("WinTitleMatchMode", 4)

$WinTitle = "Fix Me!"
$hWin = WinGetHandle($WinTitle, "")
$hStatus = ControlGetHandle($hWin, "", "[Class:StatusBar20WndClass]")
$avStatusParts = _Status_GetParts ($hStatus)
$sMsg = ""
For $n = 0 To $avStatusParts[0] - 1
    $sMsg &= $n & ": " & _Status_GetText ($hStatus, $n) & @CRLF
Next
MsgBox(64, "Results", "Text From Status Bar Parts:" & @CRLF & $sMsg)

Without the app, or one with the same type of status bar, I can't test it.

Hope that helps.

:)

Well, that could have been a big help, and was certainly worth a try, but unfortunately it didn't work. _Status_GetParts did return seven parts from the status bar, but unfortunately _Status_GetText returned null strings for all seven parts. :-(

Let me know if any other ideas, and thanks again.

Kevin M.

Share this post


Link to post
Share on other sites

Well, that could have been a big help, and was certainly worth a try, but unfortunately it didn't work. _Status_GetParts did return seven parts from the status bar, but unfortunately _Status_GetText returned null strings for all seven parts. :-(

Let me know if any other ideas, and thanks again.

Kevin M.

Using _Status_GetTextFlags returns 268435456 (10000000 hex) for the first five parts. I haven't yet located a reference that provides the decoded bit values in the high word. Can anyone tell me if this means that these status bar parts are "owner-drawn"?

Kevin M.

Share this post


Link to post
Share on other sites

Using _Status_GetTextFlags returns 268435456 (10000000 hex) for the first five parts. I haven't yet located a reference that provides the decoded bit values in the high word. Can anyone tell me if this means that these status bar parts are "owner-drawn"?

Kevin M.

Finally found that 1000 hex (high word) *does* mean that the status bar part is "owner drawn". Which means that there is no direct way to obtain the displayed text.

SO, I'm wondering now if there is some way that I can use AutoIt to perform a bit map comparison against this portion of the status bar instead...?

Kevin M.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Finally found that 1000 hex (high word) *does* mean that the status bar part is "owner drawn". Which means that there is no direct way to obtain the displayed text.

SO, I'm wondering now if there is some way that I can use AutoIt to perform a bit map comparison against this portion of the status bar instead...?

Kevin M.

Try Pixelchecksum(). Run your operation and wait until the status bar says ready. Record the pixelchecksum for that. Then in your app, code a while/sleep/wend loop waiting for that checksum. You can limit the portion of the screen that's checked by passing the control coordinates to pixelchecksum and using pixelchecksum mode 3 (coordinates relative to client window).

EDIT: Forgot to say thtis method worked for me when coding the Outlook Express UDF (see my .sig) - inside the UDF, I have a _OE_PaneGetChecksum() routine which finds the coordinates of an OE folderlist or messagelist pane and uses Pixelgetchecksum to track changes to those panes.

Edited by MisterBates

Share this post


Link to post
Share on other sites

Try Pixelchecksum(). Run your operation and wait until the status bar says ready. Record the pixelchecksum for that. Then in your app, code a while/sleep/wend loop waiting for that checksum. You can limit the portion of the screen that's checked by passing the control coordinates to pixelchecksum and using pixelchecksum mode 3 (coordinates relative to client window).

EDIT: Forgot to say thtis method worked for me when coding the Outlook Express UDF (see my .sig) - inside the UDF, I have a _OE_PaneGetChecksum() routine which finds the coordinates of an OE folderlist or messagelist pane and uses Pixelgetchecksum to track changes to those panes.

Thanks a lot for your suggestion. I have started a separate thread where I already ventured down this path (see Status Bar Pixel Checksum in this forum). However, I have a problem with this approach because my app needs to run in the background, i.e. as an inactive window. Therefore PixelChecksum won't work, unfortunately. :-( I don't suppose you happen to know of any way to perform a pixel checksum on an inactive (potentially minimized) window?

Kevin M.

Share this post


Link to post
Share on other sites

Thanks a lot for your suggestion. I have started a separate thread where I already ventured down this path (see Status Bar Pixel Checksum in this forum). However, I have a problem with this approach because my app needs to run in the background, i.e. as an inactive window. Therefore PixelChecksum won't work, unfortunately. :-( I don't suppose you happen to know of any way to perform a pixel checksum on an inactive (potentially minimized) window?

Kevin M.

Unfortunately not. Only thought that occurs is to investigate the WIndows API to see if you can get back a bitmap of the ownerdrawn control that could be fed into a custom "checksum" routine... sorry.

Share this post


Link to post
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
Sign in to follow this  
Followers 0