Hi!
I write a macro that must do something with a document if the document is stored on a networkdrive on windows.
My network drive \\server\mm\ is mapped to D:\ . The Document-URL is always file:///D:/myfile.ods.
How can I find out the real network path.
(In Excel with VB I can test with WNetGetConnection(...) for a vality network path.)
Thanks very much
Recognize a network-url
Recognize a network-url
OpenOffice 3.x on Windows 7 / SuSE Linux 12.x
Re: Recognize a network-url
Network mapped drives on MS Windows means that the servername and the name of the SMB share are mapped to a drive letter. This means if you have a UNC path \\server\mm\ that is mapped to drive D:\ everything that comes behind this will be the same:
\\server\mm\a-very\deep\directory\path\with\a-file.txt
will become
D:\a-very\deep\directory\path\with\a-file.txt
If you know that \\server\mm is the UNC path for the network mapped drive your problem is solved. It is simply a question of string substitution.
But it seems like you are rather asking how you can find out wether a drive E: is a local drive or a network drive. Your only chance is to ask the OS: Try the gold old net use. If you are using Basic as a programming language you will have a pretty hard time to capture its output and parse it for the string E:.
Python makes this a lot easier with the open() and popen() commands.
\\server\mm\a-very\deep\directory\path\with\a-file.txt
will become
D:\a-very\deep\directory\path\with\a-file.txt
If you know that \\server\mm is the UNC path for the network mapped drive your problem is solved. It is simply a question of string substitution.
But it seems like you are rather asking how you can find out wether a drive E: is a local drive or a network drive. Your only chance is to ask the OS: Try the gold old net use. If you are using Basic as a programming language you will have a pretty hard time to capture its output and parse it for the string E:.
Python makes this a lot easier with the open() and popen() commands.
Code: Select all
C:> net use
Status Lokal Remote Netzwerk
-------------------------------------------------------------------------------
OK E: \\iova\shared Microsoft Windows Network
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
Re: Recognize a network-url
Hallo
Additional to Rudolfo:
Do explizit test with:
>: net use D:
Karolus
Additional to Rudolfo:
Do explizit test with:
>: net use D:
Karolus
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 24.8… flatpak on Debian 12 (Bookworm) (on RaspberryPI4)