Is there an elegant way to capture all data between a sending a command and the next prompt. I can do it by capturing everything as a temp trigger and then disabling the trigger on prompt, but I was wondering if there's a more elegant way? I'm also using Svo, if that matters.
0
Comments
trigger 1:
type: lua
pattern: return true
script:
captured_lines = captured_lines or {}
captured_lines[#captured_lines] = line
trigger 2:
type: lua
pattern: return isPrompt()
script:
disableTrigger("trigger 1")
Trigger 1 should be disabled by default. When you want to send your command, do
captured_lines = {}
enableTrigger("trigger 1")
send(command)
After the prompt, the table captured_lines will contain all the lines that came between when you sent the command and the next prompt.
If instead you want the capture to start when your command goes through, just move the
captured_lines = {}
enableTrigger("trigger 1")
part to a trigger that fires when the command goes through.
I'm not entirely sure why you'd want to do this. I suspect that depending on what you're ultimately going for, it would probably be best to do it with a trigger chain, but it's hard to say without a better idea of what you're trying to acheive.