Skip to main content

I have a reflection basic script that will read a text file and transmit each line of that text file to what ever device that I'm connected to. What I cannot figure out is how to read the response from the device to see if the command that was sent failed, device will report command failure ("Error: Bad command"). I have waitforstring to wait for the prompt to get back before going onto the next line in the text document but if I get say "error" from the device that I'm connected to I want to stop the script so that no more commands are sent. Thanks for the help.


#Reflection
#Reflection14.x

I have a reflection basic script that will read a text file and transmit each line of that text file to what ever device that I'm connected to. What I cannot figure out is how to read the response from the device to see if the command that was sent failed, device will report command failure ("Error: Bad command"). I have waitforstring to wait for the prompt to get back before going onto the next line in the text document but if I get say "error" from the device that I'm connected to I want to stop the script so that no more commands are sent. Thanks for the help.


#Reflection
#Reflection14.x
Instead of "WaitForString", use "WaitForStrings". This function allows you to wait for any number of different strings to be received from the host system. You can check which of the strings was received first, and take appropriate action based on that. If you get the normal prompt string first, cool, do the next line, or if you get "Error: Bad command"), deal with that, or quit the program.

Reflection documentation for WaitForStrings