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