zoltang Posted December 18, 2012 Share Posted December 18, 2012 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 19, 2012 Moderators Share Posted December 19, 2012 (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 December 19, 2012 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 More sharing options...
zoltang Posted December 20, 2012 Author Share Posted December 20, 2012 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 More sharing options...
zoltang Posted December 20, 2012 Author Share Posted December 20, 2012 Sorry, lost the attachment on my reply.events.bmp Link to comment Share on other sites More sharing options...
ileandros Posted December 20, 2012 Share Posted December 20, 2012 For....to....Next I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 20, 2012 Moderators Share Posted December 20, 2012 (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) WendIf 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 December 20, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now