#1
|
|||
|
|||
Why doesn't this For loop work?
Trying to automate a simple login process before I expand it to work on multiple devices that have different prompts, but I keep getting an Unexpected 'Next' error when it's ran and not sure why:
Code:
For x = 0 To 2 ' Loop this code 2 times (once for username, and again for password) result = crt.screen.waitforstrings ("ACS5.5 username:", "ACS5.5 password:", "password:", 5) ' wait 5 seconds for each try Select Case result Case 0 msgbox "timeout occurred" Case 1 crt.Screen.Send usr & VbCr ' Send your username followed by a carriage return Case 2 crt.Screen.Send pw & VbCr ' Send your password followed by a carriage return Case 3 crt.Screen.Send pw & VbCr ' Send your password followed by a carriage return Crt.Sleep 1000 ' wait 1 second Next |
#2
|
|||
|
|||
Hi djvj,
It looks like the For loop error may be a bit of a red herring. I think it just a matter of your Select Case missing the End Select. Code:
Select Case result Case 0 msgbox "timeout occurred" Case 1 crt.Screen.Send usr & VbCr Case 2 crt.Screen.Send pw & VbCr Case 3 crt.Screen.Send pw & VbCr End Select
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
Thank you! Yes that worked.
|
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|