OO-Snippets: Start UNO Acceptor using an ooRexx script

Commons

Keywordsstart, uno, acceptor, ooRexx, script
LanguageooRexx
ApplicationOffice
AuthorsJosef Frysak (initial)
Supported Versions2.4.1  
Supported OSLinux  Win32  
QuestionHow to start an Acceptor of Open Office using an ooRexx script?
Answer

First find out which operating system is used and where Open

Office has been installed to. Then call soffice executable

with "-accept" parameter to start an acceptor.

For further details see http://wi.wu-wien.ac.at/rgf/diplomarbeiten/BakkStuff/2008/200809_Frysak/200809_Frysak_Automating_OOo_ooRexx_Nutshells.pdf.

Code-Snippet-Listing (snippet-source)

-- using rexxj command use ADDRESS function otherwise you get an error
-- find out which operating system is present and set up the shell execution
/* Normally ooRexx is able to determine the operating system itself. But calling
the macro with rexxj or inside Open Office disables this ability.*/
if .uno~path.separator=";" then
do
-- Windows
-- the start command is necessary when using windows, otherwise an error occurs.
-- also the location of the soffice program differs
add = 'start C:\Programme\"OpenOffice.org 2.4"\program\'
ADDRESS CMD
end
else
do
-- Linux
shell=value("SHELL",,"ENVIRONMENT") -- get type of shell
shell=substr(shell, shell~lastpos("/")+1) -- get shell name
ADDRESS VALUE shell -- set shell as command shell
add = ''
end
command = add || 'soffice "-accept=socket,host=localhost,port=2002;urp;" -quickstart'
-- execute command
command
-- by using SysSleep we wait 2 seconds
call SysSleep 2;
::requires UNO.CLS

Changelog

DateUserModification
2008-10-121Initial version

and