Terminal truncates long do shell script command

I have developed an applescript that when I insert a DVD prompts me for DVD info and encodes the titles accordingly for a TV Show by using the Handbrake CLI and generating a long series of Handbrake commands concatenated with ; to repeat the command for each title.

First I generate the shell command by looping through for each title and generating the filename and command line and appending it to a variable shell_command. When I am done looping through the titles I execute the following code to run the handbrake commands in order for each title.

tell application "Terminal"
    activate
    do shell script shell_command
end tell

When I run this code the terminal application opens and pastes in say 5 of 8 commands and will include maybe half of the 6th. I am unsure if I am running into a problem with the terminal “do shell script” command or if there is a string variable length restriction i am unaware of.

Thanks in advance.

Hi,

you don’t need the Terminal application tell block

do shell script shell_command

is sufficient

My understanding is that this will run the script in the background. I would prefer the script run in the terminal window so that I may track the progress of the encoding.

the proper Terminal AppleScript command is do script, not do shell script