OpenOffice Calc Macro: Run shell command and return output as result of custom function

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-06-07T06:18:23Z Indexed on 2010/06/07 6:22 UTC
Read the original article Hit count: 232

Filed under:
|
|
|
|

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!

© Stack Overflow or respective owner

Related posts about shell

Related posts about macros