Hi, On Tue, Feb 19, 2013 at 02:02:25PM +0530, Anandha Kannan wrote: > Hello there, > > Am trying to automate open office from my application developing for > MAC. Am using OO SDK 3.4.1 in Mac OSX 10.7.4. When i want to launch OO from > my application using osl/process.h: [b]osl_executeProcess[/b] using the > following code, I get error osl_Process_E_Unknown. OSL_executeprocess can > be used in Mac? Does it work for anyone to launch OO process on Mac. Any > guidance/help would be greatly appreciated. > > > *.......* > * .......* > * OUString appExe = OUString::createFromAscii("open -a > /Applications/OpenOffice.org.app/Contents/MacOS/scalc"); * > * OUString FileURL;* > * if(osl::FileBase::getFileURLFromSystemPath(appExe, FileURL) != > osl::FileBase::E_None)* > * {* > * cout << "Cannot Convert Application Path to URL" << endl;* > * }* > * OUString AppArgs = > OUString::createFromAscii("/Volumes/data/test.ods");* > * oslProcessError osl_error = osl_executeProcess(FileURL.pData, > &AppArgs.pData, 1, osl_Process_DETACHED, 0, NULL, NULL, 0, &rProcess );*
If the command you execute in the command line is open -a /Applications/OpenOffice.org.app/Contents/MacOS/scalc /Volumes/data/test.ods Then "<path_to>/open" should be the first parameter; "-a", "/Applications/OpenOffice.org.app/Contents/MacOS/scalc" and "/Volumes/data/test.ods" shouold be in the array of the second parameter, and the third, the arguments count, is 3. That said, it seems there is no need to use "open -a" with osl_executeProcess, on MacOS, this example compiles and runs fine (run make with PRJ=$OO_SDK_HOME): http://svn.apache.org/viewvc/openoffice/devtools/sdk-examples/trunk/cpp/ProcessTest/ You can check the examples with subversion: svn co https://svn.apache.org/repos/asf/openoffice/sdk-examples/trunk sdk-examples Regards -- Ariel Constenla-Haile La Plata, Argentina
pgpHYGUwKyzNd.pgp
Description: PGP signature