do script command without opening two Terminal windows?

I want to know if it is possible to use “do script” without having Terminal always open 2 windows? It seems to always open 1 window with nothing going on then on top of that runs the actual command I want to see and monitor.

	
tell application "Terminal"
		activate
		do script with command render_cmd
end tell

If anyone knows a way to do this please let me know! Appreciate it.

Well, the obvious question is whether you need to use any window at all.

AppleScript’s do shell script command will execute a shell command without needing Terminal.app at all:

do shell script render_cmd

That said, if you do want to run the command in Terminal.app (e.g. you want to interact with it, or watch its progress) then be specific about where you want it to run:

tell application "Terminal"
       activate
       do script with command render_cmd in window 1
end tell

just bear in mind that this is just like typing the command in the specified window and has no bearing or knowledge on what’s going on in that window (e.g. there may be some other process already running in window 1)

A window is necessary as it shows the progress of what will likely be a very long render.

Adding “in window 1” unfortunately didn’t work, but I decided to just try putting “activate” after the “do script…” command and that worked perfectly.

Thanks for the info!