home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2004 June / VPR0406.ISO / STARSUITE7 / EVALUATION / windows / office7 / f_0352 / DicOOo.xba < prev    next >
Extensible Markup Language  |  2004-02-13  |  2KB  |  60 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="DicOOo" script:language="StarBasic">Option Explicit
  4.  
  5. Sub StartDicOOo
  6.  
  7. Dim ThePath as string
  8. Dim DefPath as string
  9. Dim aService as object
  10. Dim MyDicOOo as string
  11. dim TheDoc as object
  12. dim args(1) as new com.sun.star.beans.PropertyValue
  13.  
  14. on error resume next
  15.  
  16. ' Find path
  17. aService = CreateUnoService("com.sun.star.util.PathSubstitution")
  18. ThePath =ConvertToURL(aService.substituteVariables("$(user)", true))
  19. ThePath=ThePath & "/wordbook"
  20. DefPath =ConvertToURL(aService.substituteVariables("$(prog)", true))
  21. DefPath=DefPath & "/../share/dict/ooo"
  22.  
  23. MyDicOOo=""
  24.  
  25. if  fileExists(ThePath & "/DicOOo.lst") then
  26.     'read DicOOo.lst file in user directory
  27.         Open ThePath & "/DicOOo.lst" for input as #1
  28.                 line input #1, MyDicOOo
  29.         close #1
  30. else
  31.     if fileExists(DefPath & "/DicOOo.lst") then
  32.     'read DicOOo.lst file in share directory
  33.         Open DefPath & "/DicOOo.lst" for input as #1
  34.                 line input #1, MyDicOOo
  35.         close #1
  36.     else
  37.         'creates default file in user directory
  38.         Open ThePath & "/DicOOo.lst" for output as #1
  39.             print #1,convertFromURL(DefPath & "/DicOOo.lst")
  40.         close #1
  41.     endif    
  42. endif
  43.  
  44. 'security 
  45. if Not fileExists(MyDicOOo) then
  46.         MyDicOOo= DefPath & "/DicOOo.sxw"
  47. endif
  48.  
  49. MyDicOOo=ConvertToURL(MyDicOOo)
  50.  
  51. 'Opens DicOOo main file
  52. args(0).name="InteractionHandler"
  53. args(0).value=""
  54. args(1).name="MacroExecutionMode"
  55. args(1).value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN '4
  56. TheDoc=StarDesktop.loadComponentFromURL(MyDicOOo,"_blank",0,args())
  57.  
  58. End Sub
  59. </script:module>
  60.