pgstein104 Posted April 6, 2010 Report Share Posted April 6, 2010 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 Quote Link to comment
asbo Posted April 6, 2010 Report Share Posted April 6, 2010 What about cmd /c "C:\Program Files\OpenOffice.org 3\program\scalc.exe" macro:///IES13148.Module1.PrintDocument("C:\Documents and Settings\test13.csv")? Quote Link to comment
pgstein104 Posted April 7, 2010 Author Report Share Posted April 7, 2010 What about: cmd /c "C:\Program Files\OpenOffice.org 3\program\scalc.exe" macro:///IES13148.Module1.PrintDocument("C:\Documents and Settings\test13.csv") I have tried that also. Then nothing executes. Quote Link to comment
asbo Posted April 7, 2010 Report Share Posted April 7, 2010 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? 1 Quote Link to comment
pgstein104 Posted April 7, 2010 Author Report Share Posted April 7, 2010 That did it! Thanks alot. My back-up plan was to replace all spaces with '?'s and convert them back in my macro. Thanks! Quote Link to comment
asbo Posted April 7, 2010 Report Share Posted April 7, 2010 Woohoo! Feel free to kudo Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.