I am running an experiment in a remote host and to to that i have a shell script that does some tasks, calls osascript that launches several terminal windows that perform some of the tasks, some inside an ssh session, then closes.
Now in order to do that i have to keep the terminal window in in context so when it is time to close i can keystroke the terminate and then accept the drop down menu asking if i want to quit (because ssh open). If i have for example safari open and am browsing this closes the browser.
My question is if there is a better way to do this because i have to keep always this terminal window, with its 6 tabs, open and this does not give me liberty to do other tasks meanwhile
Bellow is my snippet
osascript -e 'tell app "Terminal" do script "" delay 0.2 do script " /*do stuf inside ssh*/ " in tab 1 of front window delay 0.2 my makeTab() do script " /*do stuf here*/ " in tab 2 of front window delay 0.2 my makeTab() do script " /*do stuf here*/ " in tab 3 of front window delay 0.2 my makeTab() do script " /*do stuf inside ssh*/ " in tab 4 of front window my makeTab() do script " /*do stuf here with tshark */ tshark -i en0 -f \"udp dst port 5683 or udp src port 5683\" -w sink.pcap " in tab 5 of front window my makeTab() do script " /*do stuf here*/ " in tab 6 of front window delay '$CLOSE_WINDOW_DELAY' my ending() end tell on makeTab() tell application "System Events" to keystroke "t" using {command down} delay 0.5 end makeTab on ending() tell application "System Events" to keystroke "w" using {command down, shift down} delay 0.9 tell application "System Events" to keystroke return /*for the question due to ssh session*/ end ending ' Thank you in advance