How to Judge That Output of Show Command Has Appeared?

I start to use this app recentlly ,it is really good.
Right now I am using putty to execute many show command on switches .For some show command ,the result is showed very quickly ,for some command it is very slowly ,I have to take pause 4 minute for special command waiting for result .It will take an hour to finished all process .
So ,My question is if I use pause until to save time ,how could I judge the show command 's output has showed in putty windows ,I have look for all if conditions but I didn't find the right one .
Thanks for help ! appreciate .

Could you show more details of how your current macro/code works so that we can understand better?

I'm not sure if this helps, but instead of using PuTTY, could you swap to using iTerm (which is also free) and use its Triggers to look for a particular string/regex (the string your script displays when it completes successfully) and then run a command - which could run a KM macro...?

open "kmtrigger://macro=Run%20This%20Macro"

Best wishes,
Steve

Thanks Steve, I think it is very helpful, as you know, I am not very familiar with KM, in "Pause Until how will KM know the Trigger value, could you please tell me the detail step?

I think this needs a different approach. Some ideas:

  1. Would it be possible for the command on the switch to be run automatically in a single SSH command eg. ssh my-switch-address "net show interface pluggable" (assuming you use a key not password to login and the passphrase is in your agent)? (See here for a longer example). If so, KM can wait for it to complete and then parse the output.

  1. If that's not possible, an expect script might help (maybe!?). Again, use public keys not passwords (examples of expect are obsessed with plain text passwords!)

  2. If these aren't possible, and you can only wait for output to appear in the terminal window you're sending commands to, would a KM macro like this work...? When the command completes, the terminal application (iTerm) notifies KM of its next action via a Trigger.

  • Look for a numeric parameter in %TriggerValue%. If it is not supplied, default to 1. Set commandNumber to this value.
  • Optional: any extra steps before running a particular command, based on the current commandNumber (this might include things to do after the previous command had finished).
  • Find the command to run in your commandlist based on the commandNumber.
  • Type/paste the command into the iTerm session.
  • That's all! (the macro has to wait to be called again with a different value)

Then set up iTerm Triggers:

  • Regex to match completion of command 1: open KM macro with parameter '2': open "kmtrigger://macro=Your%20Macro%20Name?Value=2"
  • Regex to match completion of command 2: open KM macro with parameter '3': ': open "kmtrigger://macro=Your%20Macro%20Name?Value=3" etc

I'm not sure if this is helpful - or if it will work - and there may be simpler ways to do this!