OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Check whether Writer is installed

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Rocko
General User
General User


Joined: 04 Nov 2008
Posts: 17

PostPosted: Wed Nov 12, 2008 2:22 am    Post subject: Check whether Writer is installed Reply with quote

Is there a programmatically way to check whether Writer is installed without loading OO (ie: creating a new Writer doc).
I'm running Windows XP and OO 3.0.
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Wed Nov 12, 2008 2:38 am    Post subject: Reply with quote

Check com.sun.star.text.TextDocument service is registered in the ModuleManager.
Code:
  oModuleManager = CreateUnoService( _
    "com.sun.star.frame.ModuleManager" )
  If oModuleManager.hasByName( "com.sun.star.text.TextDocument" ) Then
   msgbox "Writer component is installed."
 End If
Back to top
View user's profile Send private message
Rocko
General User
General User


Joined: 04 Nov 2008
Posts: 17

PostPosted: Wed Nov 12, 2008 3:55 am    Post subject: Reply with quote

hanya wrote:
Check com.sun.star.text.TextDocument service is registered in the ModuleManager.
Code:
  oModuleManager = CreateUnoService( _
    "com.sun.star.frame.ModuleManager" )
  If oModuleManager.hasByName( "com.sun.star.text.TextDocument" ) Then
   msgbox "Writer component is installed."
 End If


Thanks, but that loads OO. I'm looking for a way to check it without loading the OO binaries because it takes too long. I used this VB version of your code:

Code:

Private Function WriterIsInstalled() As Boolean
    On Error GoTo ErrorHandler
   
    WriterIsInstalled = False
   
    Dim oServiceManager As Object
    Dim oModuleManager As Object
   
    Set oServiceManager = CreateObject("com.sun.star.ServiceManager")
    If oServiceManager Is Nothing Then Exit Function
   
    Set oModuleManager = oServiceManager.createInstance("com.sun.star.frame.ModuleManager")
    If oModuleManager Is Nothing Then Exit Function
   
    If oModuleManager.hasByName("com.sun.star.text.TextDocument") Then
        WriterIsInstalled = True
    End If
       
    Exit Function
   
ErrorHandler:
End Function
Back to top
View user's profile Send private message
woung
General User
General User


Joined: 13 Nov 2008
Posts: 7
Location: Germany, Nürnberg

PostPosted: Thu Nov 13, 2008 6:46 am    Post subject: In Window-environment: check the registry Reply with quote

In context = MS Windows:
check if the following entry exists in the Window's registry:
HKEY_CLASSES_ROOT\CLSID\{82154420-0FBF-11d4-8313-005004526AB4}\LocalServer32
-> default-value should contain the fullname of soffice.exe

.. that's working for OO 2.41, not sure about OO 3.0
_________________
All the best,
W.U.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group