[Lazarus] RE : Trying to use TProcess to run Open Office calc

Ludo Brands ludo.brands at free.fr
Fri Jul 22 19:12:13 CEST 2011


Tried this with OO 3.3.0 (OOO330m13 and OOO330m20) on XP and it worked just
fine, with or without the commented line.
The path contains a space character which should be avoided. I would suggest
(assuming CurrentProcessFileName ins't double quoted) :

AProcess.CommandLine := '"C:\Program Files\OpenOffice.org
3\program\scalc.exe" "' + CurrentProcessFileName +'"';

Another point you need to pay attention to: scalc.exe doesn't do much more
than launching soffice.exe which in turn creates a process soffice.bin. When
you close the openoffice app, depending on your config you can still have
soffice.exe hanging around (icon in notification area of the taskbar). This
means that the wait on exit will last sometimes longer thatn you intended.
Also if soffice.exe is in your tasklist, starting scalc.exe will return the
wait on exit immediately because it will just launch a new task in the
already running soffice.exe.

Ludo


-----Message d'origine-----
De : Mark E. Skeels [mailto:meskeels at gmail.com] 
Envoyé : vendredi 22 juillet 2011 17:42
À : lazarus at lists.lazarus.freepascal.org
Objet : [Lazarus] Trying to use TProcess to run Open Office calc


Hello, All,

I'm trying to run the following code.

It runs if I leave the option line commented out.

If I uncomment the option line it hangs.

This did not happen until I downloaded the latest version of Open Office
this AM. 

I was running Open Office 3.1. (worked as expected)

I am now running Open Office 3.3. (hangs and Open Office Calc never starts)

I saw the warnings about using pipes and reading information back; I am not
doing any of this; just trying to open the spreadsheet, edit it, and close
it while waiting to return in the Lazarus program.

When I reset the debugger calc opens as expected.

I'm running under Windows Vista.

Any idea what is going on, please? 

  AProcess := TProcess.Create(nil); 

  AProcess.CommandLine := 'C:\Program Files\OpenOffice.org
3\program\scalc.exe ' + CurrentProcessFileName; 

//    AProcess.Options := AProcess.Options + [poWaitOnExit]; 

  AProcess.execute; 

  AProcess.Free; 
 

Thanks,
Mark

-- 

"If your creed and Scripture do not agree, 
cut your creed to pieces, 
but make it agree with this book." 
~Charles Spurgeon~





More information about the Lazarus mailing list