Why bother scripting the Terminal application directly if all you want
to do is run a command-line program, which you can do directly in
AppleScript?
Why bother with a PDF if the output of any command-line program is just
plain text?
You can use the "do shell script" command to run any command-line
programs you want and send the output to a plain text file.
For instance, here's a simple script that runs the "top" command and
puts the output of it into a plain text file on the desktop:
-- begin script
property outputFilename : "top_output.txt"
property outputFile : (the POSIX path of the (path to the desktop) &
outputFilename) as text
property topCommand : "top -u -l 2 -n 21 -ncols 17 > " & the quoted form
of outputFile
set commandOutput to do shell script topCommand
-- end script
As you can see there are three properties at the top of the script:
* outputFilename: the name of the text file containing the output
* outputFile: the full path of the output text file
* topCommand: the command-line program to run
Notice that the topCommand uses the > command-line syntax followed by
the path to the output file, which causes the output of the "top"
command to be placed into a new text file at that path.
The "do shell script" line at the end actually executes the command,
which in turn sends the command output to the text file on the desktop.
--
E-mail sent to this address may be devoured by my ravenous SPAM filter.
I often ignore posts from Google. Use a real news client instead.
JR