briant79 General User

Joined: 19 Sep 2006 Posts: 8 Location: Basel, Switzerland
|
Posted: Thu Feb 08, 2007 12:21 am Post subject: Script integration and template path |
|
|
Hello,
I developed a macro embedded in a Calc template file (macro.ots) and now want to provide it with initialization values from a macro.ini text file that is situated in the same folder.
When I now open a new "untitled" document from my template, I loose the information about the template document path. The Desktop.currentComponent.URL property is empty, because the new file is not stored yet and CurDir() does not always contain the right folder path, because it can be changed during run-time by another document or application.
Is there a way to reveal the path of my untitled document's parent template?
Furthermore I found a beanshell script getIP, that returns my machine's IP. I could integrate it into my macro as a user script, but did not succeed to integrate it properly into my file.
My current code is:
| Code: |
Private Const PATH_TO_GETIP = _
"vnd.sun.star.script:ZURF_ERP.getIP.bsh?language=BeanShell&location=user"
oScript = oScriptProvider.createScriptProvider("").getScript(PATH_TO_GETIP)
strIP = oScript.invoke(Array(), Array(), Array())
|
I somehow need to change the script location into:
| Code: |
Private Const PATH_TO_GETIP = _
"vnd.sun.star.script:ZURF_ERP.getIP.bsh?language=BeanShell&location=document"
|
Thanks in advance for your ideas. |
|