Jump to content

Call OpenOffice macro using SystemExec.vi


Recommended Posts

Hi guys,

I am trying to call an OpenOffice Macro from the SystemExec.vi but I suppose this could be a general question as well. The problem I am having is the macro also has a parameter that is a path with spaces. I cannot get the path to work no matter what I try.

if the command line is:

cmd /c "C:\Program Files\OpenOffice.org 3\program\scalc.exe" macro:///IES13148.Module1.PrintDocument(C:\test13.csv)

it works wonderfully. But if the argument to my macro has spaces it will not work. examples:

cmd /c "C:\Program Files\OpenOffice.org 3\program\scalc.exe" macro:///IES13148.Module1.PrintDocument(C:\Documents and Settings\test13.csv)

cmd /c "C:\Program Files\OpenOffice.org 3\program\scalc.exe" "macro:///IES13148.Module1.PrintDocument(C:\Documents and Settings\test13.csv)"

I have tried putting quotes around everything I could think of. Is this just a limitation of what I am trying to accomplish? Or am I missing something.

Any input would be appreciated, I am spinning my wheels on what should be a simple thing.

Thanks,

Paul

Link to comment

I have tried that also. Then nothing executes.

Try cmd /c ""C:\Program Files\OpenOffice.org 3\program\scalc.exe" "macro:///IES13148.Module1.PrintDocument(C:\Documents and Settings\test13.csv)"".

My initial test was cmd /c ""c:\foo bar\hello.bat" bar baz" where hello.bat is simply @echo %1 and bar and baz are separate parameters. You can stick them together by putting them in quotes ("bar baz") but then the quotes are included in the output. You can nest quotes within those quotes without consequence ("foo "bar" baz") and the output is literal, even with a pair of double-quotes. You can actually drop the trailing quote for any of these parameters and it'll drop it in the output, but that's kind of taking advantage of the parser and you can't guarantee a particular outcome anymore. The ^ character is the escape character, but I couldn't get it to make any difference.

This is all assuming your space in the path is going to mess things up, and that you'll need to encapsulate it in quotes, of course. There's an off-chance that OpenOffice would accept single quotes instead of double quotes to preserve the macro's parameter.

Cop-out: is there any reason you can't use 8.3 filenames here?

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.