Jump to content

Exiting when progress reaches certain number


zoltang
 Share

Recommended Posts

Hi,

This is my first question here, I have trawled the forum and the Web for an answer to this but I can't figure it out.

I have a window, (a ClearCase event history window) this loads events until a limit is reached, then stops. The number of events is displayed in a statusbar at the bottom of the window.

See screenshot for this.

The problem I have is that I need AutoIt to close the window when the events reach 100.

I have found the window and control details using WindowInfo (also attached)

Now, getting the status bar information isn't the problem, I just don't know how to monitor it until it reaches 100.

A code snippet is here, some is commented out, as I was getting window information in various places. The final message box displays the correct statusbar value but I don't know how to manipulate it.

Oh, the window title may also change each time depending on where it was invoked from which is why I was finding it.

WinWaitActive("")

;$mainHwnd=WinGetHandle("")

;WinActivate($mainHwnd)

;MsgBox(0, "winhandle",$mainHwnd)

;$title =WinGetTitle("")

;MsgBox(0, "title",$title)

;$handle = ControlGetHandle ("$title", "", "[CLASS:msctls_progress32; INSTANCE:1]")

;MsgBox(0, "handle",$handle)

$status = StatusbarGetText("","","3")

MsgBox(0, "this is it",$status)

many thanks,

Zoltan

post-76933-0-08238900-1355855624_thumb.j

post-76933-0-26546300-1355855633_thumb.j

Link to comment
Share on other sites

  • Moderators

Hi, zoltang, welcome to the forum. You mention you're able to successfully get the information you need using StatusBarGetText. Can you please post a sample output from these lines, so we can see what the value of $status would be?

$status = StatusbarGetText("","","3")
MsgBox(0, "this is it",$status)

If you're getting the information correctly, as you say, you should easily be able to do a loop to keep checking until it reaches 100.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks for the welcome!

Yes, I forgot to attach the StatusBarGetText output, I've taken a shot of it. The value in the shot is 0 as it grabbed it at the beginnning of the run.

I just wasn't sure how to get it to accurately check when it reaches 100.

Link to comment
Share on other sites

  • Moderators

There are a couple of different ways you could go with this. If you are only waiting for $status to reach a certain number, you could use a While loop:

While 1
$status = StatusbarGetText("","","3")
     If $status = "Events: 100" Then
         ;do stuff here
     EndIf
    Sleep(100)
Wend

If you're doing other things, and want to check on $status intermittently, you could use AdLibRegister (check the help file for more options, this is just a quick and dirty example):

AdlibRegister("CheckStatus", 2000)

Func CheckStatus()
$status = StatusbarGetText("","","3")
     If $status = "Events: 100" Then
         ;do stuff here
     EndIf
EndFunc
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
 Share

  • Recently Browsing   0 members

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