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

How can I get the full path of current open file

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


Joined: 20 Oct 2004
Posts: 3

PostPosted: Wed Oct 20, 2004 1:34 pm    Post subject: How can I get the full path of current open file Reply with quote

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
View user's profile Send private message
RockyZ
Newbie
Newbie


Joined: 20 Oct 2004
Posts: 3

PostPosted: Wed Oct 20, 2004 2:22 pm    Post subject: Re: Reply with quote

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
View user's profile Send private message
RockyZ
Newbie
Newbie


Joined: 20 Oct 2004
Posts: 3

PostPosted: Wed Oct 20, 2004 2:29 pm    Post subject: Re: Reply with quote

I got it. Iuse Instr() function with wrong order. It should be Instr(DocFullPath, "test").
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Thu Oct 21, 2004 2:50 pm    Post subject: Re: How can I get the full path of current open file Reply with quote

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
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