3 messages in org.openoffice.fr.progRe: [prog] Arrêter OpenOffice en lign...
FromSent OnAttachments
Sébastien VINOTOct 18, 2007 5:55 am 
Didier Dorange-PattoretOct 18, 2007 9:20 am 
Sébastien VINOTOct 18, 2007 9:45 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [prog] Arrêter OpenOffice en ligne de commandeActions...
From:Didier Dorange-Pattoret (ddor@dmaths.com)
Date:Oct 18, 2007 9:20:46 am
List:org.openoffice.fr.prog

Bonjour,

Dans le fichier Install.odt de l'archive de dmaths, on trouve des macros qui ferment totalement OOo (Quickstarter inclus) puis le relance.

Je les ai écrites, il y a un bon moment ...

On récupère le handle de la fenêtre active de OOo

Declare Function GetActiveWindow Lib "user32" () As Long HandleWin = GetActiveWindow

puis on crée ce module dans la bibliothèque standard :

Sub CreeModuleCloseQuick rem cette macro installe un module contenant la macro qui arrête le quickstarter Dim oLib as Object, sCloseQuick as String sCloseQuick = "Rem Copyright Didier Dorange-Pattoret 2006" sCloseQuick = sCloseQuick & Chr(13) & "Declare Sub ExitProcess Lib ""kernel32"" (ByVal uExitCode As Long)" sCloseQuick = sCloseQuick & Chr(13) & "Sub CloseQuick(hWnd as Long)" sCloseQuick = sCloseQuick & Chr(13) & "ExitProcess(hWnd)" & Chr(13) & "End Sub" oLib = GlobalScope.BasicLibraries.Standard If oLib.hasByName("DmCloseQuick") Then oLib.removeByName("DmCloseQuick") EndIf oLib.InsertByName("DmCloseQuick",sCloseQuick) End Sub

La macro CloseQuick est appelée avec paramètre hWnd grace à la ligne :

sLine = sCheminOffice & " ""macro:///Standard.DmCloseQuick.CloseQuick(" & Cstr( HandleWin ) &")"""

dans un fichier batch.

C'est bricolé mais ça marche ... :-)

www.dmaths.org

Cordialement.

Sébastien VINOT a écrit :

Bonjour,

Dans le cadre d'un service UNO je souhaite créer un batch (windows oblige) mais je dois fermer openoffice préalablement. Esce possible en ligne de commande ?

-- Didier Dorange-Pattoret Tel : 06.85.23.38.31 Fax : 09.57.82.84.04

http://www.dmaths.org http://sesamath.net

S'inscrire à la liste de diffusion de dmaths: user@dmaths.org Ses archives : http://listes.dmaths.org/wws/arc/users Les Forums : http://www.dmaths.org/forum/ Mailing List in english :
http://www.dmaths.org/documentation/doku.php?id=presentation:listdif

Le livre de référence pour OpenOffice.org2 :
http://www.amazon.fr/exec/obidos/ASIN/2212116381/dmaths-21 Programmation OpenOffice.org2 :
http://www.amazon.fr/exec/obidos/ASIN/2212117639/dmaths-21