Better Touch Tool with Multiple Terminal Windows (Using Companion)

Hello, I am trying to write scripting in better touch tool to send it to different terminal windows.

We are using it to send commands to the same type of device(s) (Codecs) but we need separate control over each. sometimes other terminal windows might already be open. We have a prompt set already that asks "how many terminal windows do you have open? Add 1 and enter below" So if let's say the user already has 2 terminal windows open then "set stringname to the result". Then I need a way to basically have multiple buttons that have almost identical commands with the exception of the terminal window it sends the command to. So i need something that basically says tell terminal in window x based on the string/result.