If you are trying to save the necessary information to a capture file, then you would use the capture on command to start the capture process and capture off to close the capture file. Some of the set capture commands may be useful in your particular case as well. However, if you only want to capture a portion of the incoming data, you will need to have some logic in your script to determine when to open and close the capture file. If there is some text preceding and following the exact text you are interested in, then you could use the waitfor or when target command to determine that the text you are interested in is about to appear. You could then start the capture file, save the text, then use a second waitfor or when target command to determine when to close your capture file. Hopefully this will give you some ideas to work with.