do shell script with command line utility...problems!

I’m writing an ASS app for a command line utility. When I send my command using the “do shell script” like this…


set theresult to do shell script extractpath & " -v"
set contents of text view "outputText" of scroll view "outputField" of window "monitorWindow" to theresult
set needs display of text view "outputText" of scroll view "outputField" of window "monitorWindow" to true

the window I have set up to get the response only reads the first line of what’s being returned and that’s it. There should be a whole lot of text returned, but I only get one line. I can’t figure out how to solve this issue. Anyone have any ideas? I’m thinking it has to do with the line returns or something, but I can’t figure it out.

TIA

When you execute the shell script from a simple script editor window, does it return more than a line?

I just tried running the script in Applescript, and I still only get one line. Though, when I run the script from the Terminal, I get all the output

Can you post the command?

Jon

do you mean the command line utility itself?

What I meant is, can you be more specific about the command? Is this a CLI utility that is installed by Mac OS X or is it a custom third-party tool? If it is the later, is it freely available so others could test it? If not, it looks like you’re on your own.

Jon

it’s a free third party command line tool called extract-xiso.
here is a link you can look at it if you’d like…

http://homepage.mac.com/lasolas/.Public/extract-xiso.zip

Meanwhile, you could try redirecting the output to a file. Eg:

do shell script "whatever stuff > /tmp/output.txt"
set outputText to read ("/tmp/output.txt" as posix file)

lol…that works, however, it still only gives me the first line! arrghhh! :x

Kinda interesting…
I promise that I will download the cli utility if this doesn’t work:

--> here your script, redirecting again the output to a file
set shellScript to "ls > /tmp/output.txt"
--> write "shellScript" to file, chmod file, execute file
do shell script "echo " & quoted form of shellScript & " > /tmp/exec; chmod 755 /tmp/exec; /tmp/exec | sh"
--> read output of original "shellScript"
read ("/tmp/output.txt" as POSIX file)

Perhaps such utility only returns the first line when output is not to a shell?

I have had a similar sounding problem with pdflatex. Here’s Apple’s link to shell scripting with Applescript: http://developer.apple.com/technotes/tn2002/tn2065.html

I tried redirecting output with

 pdflatex thisfile.tex 2>&1 

but it didn’t work, I still only got back the error output. If anyone has a solution to my problem, I would love to hear it.

Ben

Um, I’m not sure what your code is that is contained in extractpath but the -v parameter for extract-xiso is simply the version string that returns just one line. Even from the Terminal a complete command like:

/usr/local/bin/extract-xiso -c /path/to/folder -v

will just return “extract-xiso v2.1 for macos-x - written by in in@fishtank.com.”

Can you now post the complete code contained in the extractpath variable?

Jon

I was using the “-v” as a test to see if i could get a response from the utility. There is no code in the “extractpath”…it’s just states the path to the CLU in the app package.