Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If/Else issue in script 1

Status
Not open for further replies.

JayEngr

Technical User
Sep 2, 2021
3
US
Disclaimer, I'm not a scripter/programmer just trying to speed up a tedious portion of my job, but running into what is probably a simple issue.

I think the best approach would be an If/Else statement, I have the below code running correctly except I would like to skip 12 in the loop. So maybe and If i == 12, next. else, run continue running.

But each time I try this I get an error kicked back at the If i == 12 portion.

Can anyone make a recommendation for how to implement this? Thank you!

For i=1 to GWL_COUNT
for ticker=1 to 48
crt.Screen.WaitForString("REQ")
crt.Screen.Send( "NEW" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("TYP")
crt.Screen.Send( "GWL" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("GWL")
crt.Screen.Send( "GWE " & new_port & " " & ticker & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("LNTP")
crt.Screen.Send( "SPL" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("GAIN")
crt.Screen.Send( "0" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("PHYS")
crt.Screen.Send( Chr(34) & DESCRIP_A & " " & i & " " & "PORT " & ticker & Chr(34) & vbcr )
crt.Sleep 500
next
new_port=CInt(new_port) +1
new_ont=CInt(new_ont) +1
next
 
Here is how I've tried and failed to implement the If / Else, not sure if it's a syntax issue or I'm just boggling it up completely.

For i=1 to GWL_COUNT
If i == 12
next
Else
for ticker=1 to 48
crt.Screen.WaitForString("REQ")
crt.Screen.Send( "NEW" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("TYP")
crt.Screen.Send( "GWL" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("GWL")
crt.Screen.Send( "GWE " & new_port & " " & ticker & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("LNTP")
crt.Screen.Send( "SPL" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("GAIN")
crt.Screen.Send( "0" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("PHYS")
crt.Screen.Send( Chr(34) & DESCRIP_A & " " & i & " " & "PORT " & ticker & Chr(34) & vbcr )
crt.Sleep 500
next
End If
 
For i=1 to GWL_COUNT
If i <> 12 then
for ticker=1 to 48
crt.Screen.WaitForString("REQ")
crt.Screen.Send( "NEW" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("TYP")
crt.Screen.Send( "GWL" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("GWL")
crt.Screen.Send( "GWE " & new_port & " " & ticker & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("LNTP")
crt.Screen.Send( "SPL" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("GAIN")
crt.Screen.Send( "0" & vbcr )
crt.Sleep 500
crt.Screen.WaitForString("PHYS")
crt.Screen.Send( Chr(34) & DESCRIP_A & " " & i & " " & "PORT " & ticker & Chr(34) & vbcr )
crt.Sleep 500
next
End If
 
Thank you for the tip, the does not equal is a more elegant solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top