jfcby Posted July 27, 2008 Share Posted July 27, 2008 Hello, I'm creating a sript to insert data from an Excel Worksheet to an application. The part of the code below is giving me a problem and I can't figure out what the problem is. Maybe I've been working with it so long I'm overlooking something simple. The problem is within this section of the code, it is suppose to stop until I click the button to continue but it keeps looping: If you need to see more of my code let me know it is long. expandcollapse popupElseif $opt = 2 Then Dim $sCellValue1, $sCellValue2, $sCellValue3, $sCellValue4, $sCellValue6, $sCellValue7 Dim $msg2 ;Insert Next Part GUICtrlCreateLabel("Insert Next Part", 125, 315, 100, 25) $btn_Next = GUICtrlCreateButton("Next", 235, 315, 75, 25);Left, Down, Width, Height ;MsgBox(0, "", "$nrowM = " & $nrowM & " - " & "$lrowM = " & $lrowM) ;MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue1);& @CRLF & $sCellValue5 & @CRLF & $sCellValue6, ) $sCellValue1 = StringTrimLeft(_ExcelReadCell($oExcel1, 2, 3), 7);bldgno For $i = $nrowM To $lrowM;Loop $sCellValue2 = _ExcelReadCell($oExcel1, $i, 2);serialno $sCellValue3 = _ExcelReadCell($oExcel1, $i, 3);ffinvpart $sCellValue4 = _ExcelReadCell($oExcel1, $i, 4);description $sCellValue6 = _ExcelReadCell($oExcel1, $i, 6);roomno $sCellValue7 = _ExcelReadCell($oExcel1, $i, 7);extradesc or notes Do $msg2 = GUIGetMsg() Select Case $btn_Next ;Dim $sCellValue = _ExcelReadCell($oExcel1, $i, 1) ;Activate/Set Focus to Excel Worksheet: Equip_List_FF.xls WinActivate("Microsoft Excel - Equip_List_FF.xls", "") ;Wait for Excel Worksheet: Equip_List_FF.xls to become active WinWaitActive("Microsoft Excel - Equip_List_FF.xls", "") Sleep(2000) ; Activate/Set focus to FF Inventory Management Window WinActivate("Inventory Management - \\Remote", "") ; Wait for the Notepad become active - it is titled "Untitled - Notepad" on English systems WinWaitActive("Inventory Management - \\Remote") ; Click in FF Equipment Field MouseClick("left", 114, 135) ; Now that the Notepad window is active type some special characters Send($sCellValue3 & "{ENTER}");invpart Sleep(2000) Send($sCellValue1 & "-" & $sCellValue2 & "{ENTER 2}");serialno Sleep(2000) Send($sCellValue4 & "{ENTER 2}");description Sleep(2000) Send("U {ENTER 7}");status Sleep(2000) Send("16 {ENTER 4}");shop Sleep(2000) Send($sCellValue1 & "{ENTER}");bldgno Sleep(2000) Send($sCellValue6);loc Sleep(2000) ; Click the Extra Description Box MouseClick("left", 516, 210) ;Extra Description Box Text Send($sCellValue7) Sleep(2000) Send("!C{ENTER}") ;Case $i > $lrowM ;ExitLoop EndSelect Until $msg2 = $btn_Next Next Thank you for your help, jfcby Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB **** Link to comment Share on other sites More sharing options...
enaiman Posted July 27, 2008 Share Posted July 27, 2008 I guess your problem is about: Select Case $btn_Next This syntax is typical to a "Switch" command not a "Select" When using this in a "Select" the case will be always executed because your button "$btn_Next" exists so the "Case $btn_Next" will always be true. 2 solutions: - change your loop to: Switch $msg2 Case $btn_Next" - keep the Select loop but change the case: Select Case $msg2 = $btn_Next SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) 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