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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

While

Status
Not open for further replies.

evilScooby

Technical User
Jan 9, 2004
35
0
0
GB
Could someone help me with a simple while statement.

I need a while statement that would depending on how many pages there are on the switch push f7 a certain amount of times instead of me doing the following code.

Could it be something like
while
something = something push f7
until waitfor "^[[KCommand: "

is that how it works?
im lost. :eek:(

This is what I have just now for the procedure.



proc configall
;gets list of config all
;you need to change how many times f7 is pushed dependin on how
;many pages you have in your list config all
waitfor "^[[KCommand: "
transmit "list config all^M"
capture on
pause 3
capture off
pause 5
capture off
pause 3
capture on
sendvkey VK_F7
capture on
pause 3
capture off
pause 3
capture on
sendvkey VK_F7
capture on
pause 3
capture off
waitfor "^[[KCommand: "
 
Does the remote system inform you of how many pages there are on the switch? If so, you could use that information in your script (the easiest way would be a for loop referencing that value).

aspect@aspectscripting.com
 
no afraid the remote system aint much help.

I have to just go into the system first and see how many pages everything is, and then put it into my script.
:( its a long way to do things.
But cause some of the clients systems are so different, its a pain.
I was just lookin for an easy way to fix it.
 
If the system doesn't tell you how many pages there are, but it does display a particular prompt that tells you another page is available, you could use a when target command to key on that prompt. The when target command would then call a procedure that performs the necessary commands, sends the correct keypresses, etc.


aspect@aspectscripting.com
 
Do you have to turn off the capture every time? If you don't you can send the key whatever number of times you'd like and space out the time frame. If you're going to use waitfor try using:

if waitfor "^[[KCommand: " forever


Give this a try:
integer Loops = 0
when target 0 "^[[KCommand: " call Hitkey

proc HitKey
transmit "list config all^M"
capture on
while (Loops++) < 10
sendvkey VK_F7
pause 5
endwhile

if Loops > 9 capture off
endif
endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top