wisem2540 Posted May 15, 2015 Share Posted May 15, 2015 I am using ZebraNet Bridge to upgrade our fleet of zebra printers. The script works fine, and upgrades one printer, waits for it to complete and moves to the next. I would like to start say 3 at a time, and wait for them all to finish, then start 3 more.Here is the output from Window Info. Basically. I am using WinGetText to read the window in a loop until it finds "Operation Complete". What I need to know is, Is there a way to wait for it to show Operation Complete 3 times?Downloading Printer Firmware to: 10.10.13.19<a>Clear</a>Operation Complete<a>Details...</a>Downloading Printer Firmware to: 10.10.13.12<a>Clear</a>Operation Complete<a>Details...</a>Downloading Printer Firmware to: 10.10.13.5<a>Clear</a>Operation Complete<a>Details...</a>Auto open when a task is addedClean up Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 15, 2015 Moderators Share Posted May 15, 2015 (edited) Without seeing all of your code, you could do something like so: Local $x = 0 ;Inside WinGetText Loop $var = WinGetText(<window>) If stringinstr($var, "Operation Complete", Default, 3) Then $x += 1 If $x = 3 Then ;do next action Bleh, forget what I said, I had an idiot moment. If the window is not clearing between runs that if statement will always be true. Adjusted code to look for third occurance. Edited May 15, 2015 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...
wisem2540 Posted May 15, 2015 Author Share Posted May 15, 2015 (edited) Jlogan,thank you...so simple. I should have thought about that, but if I am looking for 3rd occurrence then I shouldnt have to increase X right? Edited May 15, 2015 by wisem2540 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 15, 2015 Moderators Share Posted May 15, 2015 (edited) Correct. Sorry for the confusion, was running off to a meeting and trying to finish the post. It should be something like this: While 1 $sVar = WinGetText("My Window", "") If StringInStr($sVar, "Operation Complete", Default, 3) Then ;Do Stuff ;ExitLoop When stuff Is done EndIf WEnd Edited May 15, 2015 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...
iamtheky Posted May 15, 2015 Share Posted May 15, 2015 or with replace_CheckString("Operation Complete ") ;1st _CheckString("Operation Complete " & @CRLF & "Operation Complete ") ;2nd _CheckString("Operation Complete " & @CRLF & "Operation Complete " & @CRLF & "Operation Complete ") ;3rd Func _CheckString($sString) stringreplace($sString , "Operation Complete" , "Operation Complete") If @Extended = 3 Then msgbox(0, @extended & " match(es)" , "Yay 3 of them!") Else msgbox(0, @extended & " match(es)" , "not yet!") EndIf EndFunc ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
jguinch Posted May 15, 2015 Share Posted May 15, 2015 or with a regex :$sHTML = "Downloading Printer Firmware to: 10.10.13.19" & @CRLF & _ "<a>Clear</a>" & @CRLF & _ "Operation Complete" & @CRLF & _ "<a>Details...</a>" & @CRLF & _ "Downloading Printer Firmware to: 10.10.13.12" & @CRLF & _ "<a>Clear</a>" & @CRLF & _ "Operation Complete" & @CRLF & _ "<a>Details...</a>" & @CRLF & _ "Downloading Printer Firmware to: 10.10.13.5" & @CRLF & _ "<a>Clear</a>" & @CRLF & _ "Operation Complete" & @CRLF & _ "<a>Details...</a>" & @CRLF & _ "Auto open when a task is added" & @CRLF & _ "Clean up" MsgBox(0, "", _StringCount($sHTML, "Operation complete" ) ) Func _StringCount($sString, $sSearch, $iCaseSense = 0, $iRegExMode = 0 ) Local $sCaseSense = "(?i)", $sRegExStart = "\Q", $sRegExEnd = "\E" If $iCaseSense Then $sCaseSense = "" If $iRegExMode Then $sRegExStart = "" $sRegExEnd = "" EndIf Return UBound ( StringRegExp($sString, $sCaseSense & $sRegExStart & $sSearch & $sRegExEnd, 3) ) EndFunc iamtheky 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF 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