Page 1 of 1
[Solved] Return current pathname without document name
Posted: Fri Jul 25, 2008 1:36 pm
by grnhorn
How can the current pathname be returned without the document name as the following does?
MsgBox ThisComponent.getURL
Thanks...
Re: Return current pathname without document name
Posted: Fri Jul 25, 2008 3:40 pm
by QuazzieEvil
There are various functions the in the
Tools library.
Code: Select all
BasicLibraries.loadLibrary("Tools")
path=DirectoryNameoutofPath(ThisComponent.getURL(),"\")
msgbox path
Re: Return current pathname without document name
Posted: Fri Jul 25, 2008 4:11 pm
by grnhorn
Thanks QuazzieEvil, but this also returns the filename attached. What I am looking for is the currentpath (current folder or directory) without the filename or.
Re: Return current pathname without document name
Posted: Fri Jul 25, 2008 5:26 pm
by JohnV
Reverse the direction of the slash, i.e., "/".
[Solved] Return current pathname without document name
Posted: Fri Jul 25, 2008 5:35 pm
by grnhorn
Thanks JohnV, that worked. I had to make one more change adding GlobalScope." Here is the final code.
GlobalScope.BasicLibraries.loadLibrary("Tools")
path=DirectoryNameoutofPath(ThisComponent.getURL(),"/")
msgbox path