matt_deploy Absent Member.
Absent Member.
1717 views

Run script fail if error found on output

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.
0 Likes
1 Reply
vfast Absent Member.
Absent Member.

Re: Run script fail if error found on output

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
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.