Eli Posted January 11, 2006 Share Posted January 11, 2006 How do you continue a script after an if/then? If $biz = "BE" Then ControlSend($window, "", 1000, "{LEFT}{LEFT}{LEFT}") ControlSend($window, "", 1000, "{UP}{UP}{UP}{UP}{UP}{UP}{UP}") ControlSend($window, "", 1000, "{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}") ControlSend($window, "", 1000, "{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}79") Else ControlSend($window, "", 1000, "{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}79") EndIf statwait() sleep(1000) ControlSend($window, "", 1000, "{RIGHT}") ControlSend($window, "", 1000, "100") ControlSend($window, "", 1000, "{TAB}") this only performs the functions in the If/Then/Else statement and then the script holds....how do I get to move past and go on to statwait() and the rest of the script Link to comment Share on other sites More sharing options...
BigDod Posted January 11, 2006 Share Posted January 11, 2006 Use ExitLoop Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2006 Moderators Share Posted January 11, 2006 If that's the whole script... it doesn't have a loop?? Then It wouldn't 'hold' anyway. If it's not the whole script... you need to post more if BigDod's ExitLoop doesn't work. P.S. If $biz = "BE" Then ControlSend($window, "", 1000, "{LEFT}{LEFT}{LEFT}") ControlSend($window, "", 1000, "{UP}{UP}{UP}{UP}{UP}{UP}{UP}") ControlSend($window, "", 1000, "{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}") ControlSend($window, "", 1000, "{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}79") Else ControlSend($window, "", 1000, "{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}79") EndIf Is the same as:If $biz = "BE" Then ControlSend($window, "", 1000, "{LEFT 3}") ControlSend($window, "", 1000, "{UP 7}") ControlSend($window, "", 1000, "{DOWN 5}") ControlSend($window, "", 1000, "{RIGHT 6}79") Else ControlSend($window, "", 1000, "{RIGHT 6}79") EndIf Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Eli Posted January 11, 2006 Author Share Posted January 11, 2006 its definitly not the whole script thanks for the tip on the key presses!!! I tried an exit loop, but it isnt a loop and it said exitloop was only for while, for, and do loops. how much of the script is needed? I'd post the whole thing, but its wrong and im sure to you guys its rather messy (case and point the multple key presses ) Link to comment Share on other sites More sharing options...
BigDod Posted January 11, 2006 Share Posted January 11, 2006 its definitly not the whole script thanks for the tip on the key presses!!! I tried an exit loop, but it isnt a loop and it said exitloop was only for while, for, and do loops.how much of the script is needed? I'd post the whole thing, but its wrong and im sure to you guys its rather messy (case and point the multple key presses )If you post the whole thing you may get tips on how to make it cleaner. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Eli Posted January 11, 2006 Author Share Posted January 11, 2006 expandcollapse popupIf $biz = "BE" Then ControlSend($window, "", 1000, "{LEFT}{LEFT}{LEFT}") ControlSend($window, "", 1000, "{UP}{UP}{UP}{UP}{UP}{UP}{UP}") ControlSend($window, "", 1000, "{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}") ControlSend($window, "", 1000, "{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}79") Else ;this arrows to the correct cells then enters the shipping discount info ControlSend($window, "", 1000, "{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}79") EndIf statwait() sleep(1000) ControlSend($window, "", 1000, "{RIGHT}") ControlSend($window, "", 1000, "100") ControlSend($window, "", 1000, "{TAB}") ;this determines billing system then sets upgrade reason If $ur = "I" Then $ur2 = "FRUEX" Else $ur2 = "FX" EndIf statwait() ControlSend($window, "", 1000, "{UP}{UP}{UP}{UP}{UP}{UP}{UP}") ControlSend($window, "", 1000, "{RIGHT}{RIGHT}") ControlSend($window, "", 1000, $ur2) ControlSend($window, "", 1000, "{TAB}") statwait() ControlSend($window, "", 1000, "{SPACE}") statwait() GUISetState(@SW_HIDE) ;finishes up and offers a message box with the next few manual steps $end = MsgBox(4, "Finished!!", "All done! MAKE SURE YOU VERIFY ALL INFORMATION BEFORE SUBMITTING!"_ & @CRLF & "Would you like to know what to do next?") If $end = 6 Then MsgBox(0, "Next steps", "") Exit Else Exit EndIf here is everything after the If/Then statement Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2006 Moderators Share Posted January 11, 2006 Where does $end = 6? ... Where is the function statwait()? I'm telling you... Partial code just don't work too good... It takes 10 x's as long to get a simple answer . Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Eli Posted January 11, 2006 Author Share Posted January 11, 2006 the whole thing expandcollapse popup; declare variables ;========================================================= dim $bill dim $dev dim $warranty dim $war dim $window dim $ok dim $device dim $ur dim $num1, $num2, $num3 dim $iMTN ;========================================================= ;sets the window match mode to determine correct ACSS window Opt("WinTitleMatchMode", 2) ;=================================================================================================== =================== ; creates the gui #include <GUIConstants.au3> GUICreate("FRUINATOR", 230, 190) ;creates the various inputs or the gui $dev = GUICtrlCreateCombo("", 10, 120, 115, 600, $CBS_DROPDOWNLIST) GUICtrlSetData($dev, "A|B|C", "A") GUICtrlCreateLabel("Please select the device to FRU", 10,100) GUICtrlCreateLabel("Is the device under warranty?", 10,40) $number = GUICtrlCreateInput("Please enter the MTN", 10, 5, 150, 20, $ES_NUMBER) $waryes = GuiCtrlCreateRadio("YES", 10,53,80) GuiCtrlSetState($waryes, $GUI_CHECKED) $warno = GuiCtrlCreateRadio("NO", 10, 70, 80) $ok = GUICtrlCreateButton(" OK ", 10, 160) $no = GUICtrlCreateButton("Cancel", 165, 160, 60) $help = GUICtrlCreateButton("?", 100, 160, 15) GUISetState() MsgBox(00, "Welcome!", "Please click ok and select the first cell under Item #.") WinSetOnTop("FRUINATOR", "", 1) ; sets the cases for responses from the gui. While 1 $msg = GUIGetMsg() Select Case $msg = $dev WinSetOnTop("FRUINATOR", "", 0) Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $no Exit Case $msg = $help WinSetOnTop("FRUINATOR", "", 0) MsgBox(0, "Help", "!") WinSetOnTop("FRUINATOR", "", 1) Case $msg = $ok WinSetOnTop("FRUINATOR", "", 0) $warX = GUICtrlRead($waryes) $device = GUICtrlRead($dev) If $warX = $GUI_CHECKED Then $warranty = "" Else $warranty = "FRUFEE" EndIf $iMTN = GUICtrlRead($number) If StringLen($iMTN) <> 10 Then WinSetOnTop("FRUINATOR", "", 0) MsgBox(0, "10 Digit MTN", "Please enter the MTN as 1234567890") WinSetOnTop("FRUINATOR", "", 1) ContinueLoop EndIf GUISetState(@SW_HIDE) ExitLoop EndSelect WEnd If @error = 1 Then Exit EndIf ;=================================================================================================== ================== ;translates devices into item codes for ACSS Select Case $device = "A" $device = "A534565" Case $device = "B" $device = "B425245" Case $device = "C" $device = "C674643" EndSelect ; Enter data into the clipboard ClipPut($device & @CRLF & "" & @CRLF & "FRURL" & @CRLF & "ABCD123" &_ @CRLF & "werty4321" & @CRLF & $warranty & @CRLF & "bcda321") ;formats $mtn string into ###-###-#### $num1 = StringMid($iMTN, 1, 3) $num2 = StringMid($iMTN, 4, 3) $num3 = StringMid($iMTN, 7, 4) $mtn = $num1 & "-" & $num2 & "-" & $num3 ; makes sure the correct window is open and active $window = $mtn WinSetState($mtn, "", @SW_RESTORE) winactivate($window) $wact = winwaitactive($window, "", 1) ;checks to make sure ACSS window is open If $wact = 0 Then MsgBox(0, "Window does not exist", "Either you have entered the mobile number wrong or another error has occured, please try again.") Exit EndIf $ur1 = WinGetTitle($window) $ur = StringMid($ur1, 1, 1) ;checks for business account $biz = ControlGetText($window, "", 1350) If $biz = "BE" Then ClipPut($device & @CRLF & "" & @CRLF & "FRURL" & @CRLF & "RTN80009EN" &_ @CRLF & "SID9203" & @CRLF & $warranty & @CRLF) EndIf ; sends the data to the correct controlID using a CTRL+V ; controlID 1000 is for GXWND1, the data grid ControlFocus($window, "", 1000) ControlSend($window, "", 1000, "^v") ControlSend($window, "", 1000, "{TAB}") ControlClick($window, "", 138);selects Bill to account ; please wait while autopop message $apop = GUICreate("Populating", 200, 50) GUICtrlCreateLabel("Please wait while ACSS autopopulates.", 10, 10) WinSetOnTop("Populating", "", 1) GUISetState() ;statwait() is a user defined function to monitor the status bar and wait till it returns 'Ready' before continuing statwait() Func statwait() While 1 $x = StatusbarGetText($window) If $x = "Ready" Then ExitLoop Else sleep(100) EndIf WEnd EndFunc ;sets cell in upper right to ensure shippng code gets entered in the correct cell for business accounts If $biz = "BE" Then ControlSend($window, "", 1000, "{LEFT}{LEFT}{LEFT}") ControlSend($window, "", 1000, "{UP}{UP}{UP}{UP}{UP}{UP}{UP}") ControlSend($window, "", 1000, "{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}") ControlSend($window, "", 1000, "{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}79") Else ;this arrows to the correct cells then enters the shipping discount info ControlSend($window, "", 1000, "{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}79") EndIf statwait() sleep(1000) ControlSend($window, "", 1000, "{RIGHT}") ControlSend($window, "", 1000, "100") ControlSend($window, "", 1000, "{TAB}") ;this determines billing system then sets upgrade reason If $ur = "I" Then $ur2 = "FRUEX" Else $ur2 = "FX" EndIf statwait() ControlSend($window, "", 1000, "{UP}{UP}{UP}{UP}{UP}{UP}{UP}") ControlSend($window, "", 1000, "{RIGHT}{RIGHT}") ControlSend($window, "", 1000, $ur2) ControlSend($window, "", 1000, "{TAB}") statwait() ControlSend($window, "", 1000, "{SPACE}") statwait() GUISetState(@SW_HIDE) ;finishes up and offers a message box with the next few manual steps $end = MsgBox(4, "Finished!!", "All done! MAKE SURE YOU VERIFY ALL INFORMATION BEFORE SUBMITTING!"_ & @CRLF & "Would you like to know what to do next?") If $end = 6 Then MsgBox(0, "Next steps", "") Exit Else Exit EndIf Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2006 Moderators Share Posted January 11, 2006 Your problem is probably right here: $x = StatusbarGetText($window) If $x = "Ready" Then Are you 100% postive that $x = 'Ready' everytime that you call that function? Because if it doesn't, you'll be stuck in that Loop in your function indefinately or until it ever does. Put this in the code and run it to see exactly what it says:$x = StatusbarGetText($window) MsgBox(0, 'Debug', '$x = ' & $x) If $x = "Ready" Then Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Eli Posted January 11, 2006 Author Share Posted January 11, 2006 awesome...that was the issue...it said 'Ready' but it returned something else. I think I can get it to work around that. thank you for the help!!! 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