Sign in to follow this  
Followers 0
zoltang

Exiting when progress reaches certain number

6 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

For....to....Next


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

√-1 2^3 ∑ π, and it was delicious!

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