Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UNC path from fullpath
#1
when you can work it into your sched, could you code something up that would get the unc from the fullpath?

thanks.

ie UNC from Explorer
An old blog on QM coding and automation.

The Macro Hook
#2
Convert full path of a local file to UNC, or get \\server\share part from full UNC path? In first case, don't know how to. If shared folder path and name and computer name is known, then replace using string functions.

Where it can be useful?
#3
the first one is what i'm shooting for.

\\server name\dir\dir\dir\filename.ext

for instance my office has 6 servers and there are numerous places for files of various sorts. instead of attaching a static file to an email, we keep our documentation in place on one server that way everyone can see it. i created a new timeline today and saved it in our documentation dir and wanted someone to look over it; it's best just to drop a unc of the file and email her the link since she can then either refer to the email later on or bookmark the link....or add it to a 'dept documents' dropdown menu in qm (like i do) :wink:
An old blog on QM coding and automation.

The Macro Hook
#4
say......anyone know how to get the drive-mapping value from a mapped drive letter?

eg w:\ = "\\server\dir"
An old blog on QM coding and automation.

The Macro Hook
#5
Can be used WNetGetUniversalName, but it seems that it only can get UNC of remote location when it is mapped to a drive letter on local computer. Also, it works on XP but does not work on Vista. Maybe this is only on my computer.

Code:
Copy      Help
;assuming \\VISTA32\app is mapped to drive Z:
str path="Z:\app\qm.exe" ;;path on remote computer
str s.all(500)
int n=500
int e=WNetGetUniversalName(path UNIVERSAL_NAME_INFO_LEVEL s &n)
if(e) end _s.dllerror("" "" e)
lpstr unc; memcpy &unc s 4
out unc ;;\\VISTA32\app\app\qm.exe
;or out s+4

But returned path is invalid. Must be \\VISTA32\app\qm.exe.
#6
works great!
thanks.

Code:
Copy      Help
;assuming you have highlighted a file in WinExplorer
;and that it is on a mapped network drive.

ARRAY(str) a
str b s
int n e
lpstr unc
s.all(500)
'Cc
GetClipboardFiles a
b=a[0]
s.all(500)
n=500
e=WNetGetUniversalName(b UNIVERSAL_NAME_INFO_LEVEL s &n)
if(e) end _s.dllerror("" "" e)
memcpy &unc s 4
out unc
An old blog on QM coding and automation.

The Macro Hook
#7
Quote:Also, it works on XP but does not work on Vista.

It does not work on Vista if QM is running as Administrator. Let the macro run in separate process, as User.

Quote:But returned path is invalid.

It is invalid when shared is folder. OK if shared is whole drive.


Forum Jump:


Users browsing this thread: 1 Guest(s)