| View previous topic :: View next topic |
| Author |
Message |
RockyZ Newbie

Joined: 20 Oct 2004 Posts: 3
|
Posted: Wed Oct 20, 2004 1:34 pm Post subject: How can I get the full path of current open file |
|
|
Hi,
I'd like to write Macro script to get full path of current open file , such as "/home/test_user/test.doc", and do some post process, link the macro to "Save As" event in OO. The problem is I can't find which service or fucntion I should use.
I know "ThisComponent" point to current open document. But how can I get file name and full path?
Thanks.
Rocky |
|
| Back to top |
|
 |
RockyZ Newbie

Joined: 20 Oct 2004 Posts: 3
|
Posted: Wed Oct 20, 2004 2:22 pm Post subject: Re: |
|
|
Sorry I did not read the forum carefully. I found the same problem in the forum.
I can use ThisComponent.getURL() or ThisComponent.Location to get URL of the file. But I encounter another problem. After I get Url of the filename, I'd like to check if it include specific string, such as "test", it never work. What's wrong?
My script is as followed:
DocFullPath = ThisComponent.Location
ResultPosition = Instr("test", DocFullPath)
if ResultPosition <> 0 Then
flag = TRUE
Else
flag = FALSE
End If
I tested, the "ResultPosition" always be 0, even DocFullPath contains "test" string.
Any ideas?
Thanks. |
|
| Back to top |
|
 |
RockyZ Newbie

Joined: 20 Oct 2004 Posts: 3
|
Posted: Wed Oct 20, 2004 2:29 pm Post subject: Re: |
|
|
| I got it. Iuse Instr() function with wrong order. It should be Instr(DocFullPath, "test"). |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Thu Oct 21, 2004 2:50 pm Post subject: Re: How can I get the full path of current open file |
|
|
| RockyZ wrote: | I know "ThisComponent" point to current open document. But how can I get file name and full path?
|
ThisComponent.getURL()
or maybe....
ConvertFromURL( ThisComponent.getURL() ) _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
|