Terry wrote:
Terry wrote:
Harold Fuchs wrote:
On Sunday, October 01, 2006 9:45 AM [GMT+1=CET], Terry
<[EMAIL PROTECTED]> wrote:
Hi, Malcolm. File >Properties : General, which you've already
discovered, is it. It gives you all the information, just separated
into path and file name.
There is a macro routine that will give you the full path and filename
combined. You could put this in your "Standard" library in "My Macros
and Dialogs" and assign it to a toolbar icon, keyboard shortcut or
menu shortcut:
Sub DocLocation
Msgbox ThisComponent.getLocation 'gets full path and file name
'Msgbox ThisComponent.getUrl 'this gets the url which is the same as
location on a Linux OS
End Sub
1. The File>Properties>General menu performs poorly for looooong
paths; it is *not* left/right scrollable like the equivalent option
in MS Word. Instead, it shows the beginning of the pathname, a few
dots indicating something is missing, and then the end of the pathname.
2. The "second line" of the supplied macro has been broken,
presumably by somebody's (mine? *only* mine?) e-mail system
truncating text to some fixed width. The words "location on a Linux
OS" must *not* be on a new line. Instead they should continue
directly on from "which is the same as ". To be clear: excluding
blank lines the macro should be four lines long:
Sub ...
Msgbox ...
'Msgbox ...
End Sub
3. The supplied macro displays spaces as "%20". I think this will
confuse "ordinary" users of word processing software who are not
necessarily experts in URL encoding technology. Perhaps someone could
supply a macro that converts the URL encoded path to human-readable
text ???
4. The supplied macro shows Windows style backslashes as UNIX style
forward ones. Could that be changed? Currently a Windows user would
not be able to copy/paste the displayed path into a native application.
Something strange happens occasionally, like now. I have your reply
but have not received my own email. ?¿
I don't know why it's returning %20. It doesn't do that normally. It
may be something to do with the way it reads location on Windows. If
it doesn't work properly on Windows, I don't know what to do because I
don't have a Windows system. It may be necessary to convert all
forward slashes to back slashes. (Ugh)
I'll do some research. In the meantime, best drop it.
I usually only anticipate mistakes I'd make myself. The difference
between code and comment seems obvious to me. It occurs to me now
that some less thoughtful soul might try to get a location for a
document which doesn't have one. Easily covered but not something I'd
normally think of. O:-)
Thanks for letting me know.
Weirder still. I've received my second message but still have not
received the first.
Strange times when I try to work out a macro for Windows on a Linux OS.
Perhaps someone could test this:
Sub DocLocation
'Needs to be tested
'Uses three backslashes for Windows; for Unix, change to forward slashes
Dim sDocUrl$, sDocPath$, sDocFileName$
If Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools") then
GlobalScope.BasicLibraries.loadLibrary("Tools")
Endif
If ThisComponent.hasLocation Then
sDocUrl = ThisComponent.URL
sDocPath = DirectoryNameoutofPath(sDocUrl, "\")
sDocFileName = FileNameoutofPath(sDocUrl, "\")
Msgbox sDocPath & "\" & sDocFileName
End If
End Sub
this still has the %20s for spaces. The one-liner seemed to work just fine.
WalterAM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]