Jump to content

Send to Windows Explorer address bar for webDAV


JonF
 Share

Go to solution Solved by computergroove,

Recommended Posts

I'm trying to get my users access to our main information store without having to connect to the VPN (which uses port 10443 and is blocked in some places). I have WebDAV set up on the server and connecting works if I type or paste:

remote.{domain}.com@SSL@443DavWWWRootDriveZ

into the Explorer address bar. It prompts for login information even if running from a domain-joined computer logged in with appropriate credentials. However, if I try to create a shortcut (in any of several ways) Explorer does not make the connection, does not display login information, and displays some local directory (usually My Documents).  It appears that the only way to make this connection is to enter the path in Explorer's address bar.  I tried the following:

$Path = "\\remote.{domain}.com@SSL@443\DavWWWRoot\DriveZ"
 
Func _GetHwndFromPID($PID)
    $hWnd = 0
    $stPID = DllStructCreate("int")
    Do
        $winlist2 = WinList()
        For $i = 1 To $winlist2[0][0]
            If $winlist2[$i][0] <> "" Then
                DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $winlist2[$i][1], "ptr", DllStructGetPtr($stPID))
                If DllStructGetData($stPID, 1) = $PID Then
                    $hWnd = $winlist2[$i][1]
                    ExitLoop
                EndIf
            EndIf
        Next
        Sleep(100)
    Until $hWnd <> 0
    Return $hWnd
EndFunc ;==>_GetHwndFromPID
 
$ExplorerPID = Run("explorer.exe")
$Handle = _GetHwndFromPID($ExplorerPID)
ControlSend($Handle,"",41477,$Path)
 
but it acts just like the shortcuts.
 
Any ideas?
Link to comment
Share on other sites

  • Moderators

First thing I'd try is _IENavigate.

To iterate on that, the object to the shell window, then use the obj.navigate method.

Edit:

Question... Would:

$gnPID = ShellExecute("\\remote.{domain}.com@SSL@443\DavWWWRoot\DriveZ")

Not work?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

To iterate on that, the object to the shell window, then use the obj.navigate method.

Edit:

Question... Would:

$gnPID = ShellExecute("\\remote.{domain}.com@SSL@443\DavWWWRoot\DriveZ")

Not work?

 

Nope, it wouldn't work.  post-38071-0-21198800-1417793279_thumb.p

It never asked for credentials.  The only way I've gotten it to ask for credentials is to enter the path directly into the address bar.

I'm not excited about using IE.  Most of my users are PhDs in biological science of one sort or another, but several of them have issues with unfamiliar concepts such as file browsing in IE.

Link to comment
Share on other sites

  • Solution

You could try mapping a network drive:

net use Z: "remote.{domain}.com@SSL$443DavWWWRootDriveZ" /user xxxx Pa$$word

Then you could delete the mapped drive:

net use z: /delete

or maybe add

#RequireAdmin at the top of your script

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

  • Moderators

Sorry, I think you missed the point with me about the .navigate, I didn't know JohonOne assumed it was IE.

This is (working/pseudo) code of what I was talking about:

Global $gsPath = "C:\Windows\System32"
; the way this is setup, you're likely to be trapped in the loop (add error checking) than to be errored out
Global $goExplorer = _createNewExplorerWindow()
$goExplorer.Navigate($gsPath)

Func _createNewExplorerWindow()

    Local $oShell = ObjCreate("Shell.Application")
    Local $oWin1 = $oShell.windows(), $oWin2
    Local $nCount = $oWin1.count()

    $oShell.Explore("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
    Do
        Sleep(50)
        $oWin2 = $oShell.windows()
    Until $nCount <> $oWin2.count()

    Return $oWin2($oWin2.count() - 1)
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

@JohnOne:  Yeah, I meant Windows explorer.  I intended to be more precise but wasn't.  Sorry.

@SmOke_N: Works fine for local paths, gives a new error message for my case: post-38071-0-68334100-1418138127_thumb.p.

@computergroove:  Aha!  That works (after adding the colon after /user and changing the / before DavWWWRoot to @).  Fascinating.  I used to have a script that mapped a free drive to WebDAV with net use, and it stopped working after some server update.  That's why I was going through this whole exercise.  But I dug up the @SSL$443@DavWWWRoot syntax well after I gave up on that idea and never thought of going back to it with the new syntax.

Problem solved!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...