views:

210

answers:

1

I would like to write a custom OpenOffice function that runs a shell command and puts the result into the cell from which it was invoked.

I have a basic macro working, but I can't find a way to capture the command's output.

Function MyTest( c1 )
    MyTest = Shell("bash -c "" echo hello "" ")
End Function

The above always returns 0. Looking at the documentation of the Shell command, I don't think it actually returns STDOUT. How would I capture the output so that I can return it in my function?

Thanks!

A: 

Can you redirect the output to a temporary file, then read in the contents of that file with another command?

eg, Shell("bash -c "" echo hello > tmp.txt "" ")

Kimball Robinson