How to make an Automator service run a Terminal and display the output

automatorrarservicesterminal

I'm using Automator to run a shell script (Rar selected files) as a 'Service', so that I can just right click a folder and select the service. It works fine, but i've added verbose and testing (to see the progress and test results) so I need to see the output of the Terminal window to make sure the archive is ok. Is there a way to see the output in real time? or to take it an extra step echo the results?

here's the script that works in automator but the output is silent.

on run {input, parameters}
set nbFiles to count input

if nbFiles = 0 then
    display dialog "No files selected!" buttons {"OK"} default button 1
    return
end if

tell application "Finder"

    set archiveDir to (container of (item 1 of input) as string)
    if nbFiles = 1 then
        set archiveName to (name of (item 1 of input) as string)
    else
        set archiveName to "archive"
    end if

    if exists file (archiveDir & archiveName & ".rar") then
        set i to 2
        repeat while exists file (archiveDir & archiveName & "-" & i & ".rar")
            set i to i + 1
        end repeat
        set archiveName to archiveName & "-" & i
    end if

    set archiveDir to quoted form of POSIX path of archiveDir
    set archiveName to quoted form of (archiveName & ".rar")

    set listFiles to " "
    repeat with i in input
        set listFiles to listFiles & quoted form of ("." & POSIX path of (name of i as string)) & " "
    end repeat

end tell

do shell script "cd " & archiveDir & "; rar a -ol[a] -mt8 -m5- -y -s -m4 -t " & archiveName & listFiles

return input
end run

THANKS!!

Best Answer

Change the following line of code:

do shell script "cd " & archiveDir & "; rar a -ol[a] -mt8 -m5- -y -s -m4 -t " & archiveName & listFiles

To:

tell application "Terminal"
    do script "cd " & archiveDir & "; rar a -ol[a] -mt8 -m5- -y -s -m4 -t " & archiveName & listFiles   
end tell