Sign in to follow this  
Followers 0
JonF

Send to Windows Explorer address bar for webDAV

8 posts in this topic

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?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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.

Share this post


Link to post
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!

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • AndreyS
      By AndreyS
      Dear developers and creators of the language, please explain to me why when pressing the combination Crtl + Shift + C from the 5th or the 10th time "sticks / sinks" Ctrl or Shift? And then you need to press Ctrl or Shift again to reset their triggering. I only need to use hot keys like in the example!
      The code is a small example. Its essence is that when a user in the editor selects any number and presses a combination, then it increases by 1. 
      Dim $x HotKeySet("+^c","Calc") While 1 Sleep(10000) WEnd Func Calc() Send("^c") Sleep(50) $x=ClipGet()+1 ClipPut($x) Send("^v") EndFunc I thought that in my program some kind of glitch was searching for a reason for a long time. And it turned out that apparently somehow the work of some functions used in the example is not compatible. 
      Tell me, please, what is the problem?
    • ur
      By ur
      If you observe in below code.
      Func _WinWaitActivate($title,$text,$timeout=$time_out) Logging("Waiting for "&$title&":"&$text) $dHandle = WinWait($title,$text,$timeout) if not ($dHandle = 0) then If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) Else Logging("Timeout occured while waiting for the window...") Exit EndIf EndFunc WinActivate("Untitled - Notepad") $p = "Notallowed1!!" Send("{ENTER}{ENTER}{ENTER}{ENTER}"& $p &"{ENTER}create{SPACE}database{SPACE}"& $p &";{ENTER}") In the notepad if you observe, ! is missing in the text got.
       
      Is there way to get that also printed.
    • rawkhopper
      By rawkhopper
      Hello everyone,
      I have a script that is automating a piece of sluggish software.  I want to automate it with a bit of caution and I am not sure the best way to do it.  ControlSend works great most of the time.  If I have it enter 10 into a text box every once in a while it will enter 1 or 11 and then hit enter.
      To overcome this I use MouseClick to select the text I just entered and then see if it matches the string it was supposed to put in before it hits enter.  This seems to work but what I love about ControlSend is there is less room for human interaction messing it up.  
      Yes I could block input but I prefer not to do that (permissions).
      Is there a better way of doing this?  Any Help would be much appreciated.
      Anyway here is the snippet of the script in question:
      Func KVSend () WinActivate ( "Window", "" ) Local $WindowPos = WinGetPos("Window", "") If $kV < 30 Then WinActivate ( "Window", "" ) ControlClick ("Window", "", 1001) ;Click in Accel Voltage box Sleep (100) ControlSend ("Window", "", 1001, $kV) ; \ kV Sleep (100) MouseMove($WindowPos[0]+130,$WindowPos[1]+75,1) MouseClick($MOUSE_CLICK_LEFT) MouseClick($MOUSE_CLICK_LEFT) Send ("^c") Local $clip = ClipGet () If $clip = $kV Then ControlSend ("Window", "", 1001, "{ENTER}") ;Hit ENTER if value is correct Sleep (100) ControlClick ("Window", "", 1518) ;Lens Clear Else Send ("{BACKSPACE}") KVSend() ; If value is incorrect try again EndIf EndIf  
    • spuuunit
      By spuuunit
      This is what I'm trying to do: In Firefox, if you hold down CTRL + C for about 200ms, then press CTRL + T. This is my code:
      While WinActive(" - Mozilla Firefox") If _IsPressed("A2", $hDLL) And _IsPressed("43", $hDLL) Then $timer = TimerInit() While _IsPressed("A2", $hDLL) And _IsPressed("43", $hDLL) Sleep(10) $diff = TimerDiff($timer) If $diff > 200 Then Send("^{T}") While _IsPressed("A2", $hDLL) And _IsPressed("43", $hDLL) Sleep(10) WEnd EndIf WEnd EndIf WEnd The problem is that the CTRL key gets stuck down after Send("^{T}"). I found this, but what I understand that happens when I release, and that is not what I want. The "General unstuck method" did nothing.
    • Baboo85
      By Baboo85
      Hi all,
      I need to start a script that include:
      - admin privileges
      - multiple cmd commands
      - no bat, no exe, no tmp files created anywhere (especially in the user temp folder)
      In a bat file it would be simple, but users shouldn't see what commands I'm sending.
      Example of the script:
      echo off cls echo. echo I AM A TOOL echo. echo NOTE: echo - note 1 echo - note 2 echo - etc set USER1=0 set COMPUTER1=0 if /i %username% equ user.user ( set USER1=1 set COMPUTER1=1 ) if /i %username% equ another.user set USER1=1 if /i %computername% equ notebook set COMPUTER1=1 if %USER1% EQU 1 ( if %COMPUTER1% EQU 1 ( reg delete "HKLM\SOFTWARE\blablabla" /f ) else ( echo Computer not authorized. Contact assistance.) ) else ( echo User not authorized. Contact assistance.) echo. pause exit With the send("") is a disaster.
      I'm a noob here, so what can I do?
       
      EDIT: OR ELSE I explain the situation and what I need, so if there is a simple solution I can use that.
       
      SITUATION: our domain users have Users rights on the machine. Some of them need administrator rights.
      We create a local user with administrator rights, so that the users must insert username and password when asked to run something with administrator rights.
      We have an internal domain group policy that blocks EXE, BAT, COM, TMP files from the user local temp directory, for a security reason (malware). That also blocks most software installation.
      But some users are often out of office, away from workplace and in another country, they need a complete control on their computers.
       
      WHAT I NEED: I need to check the username and the computer name. If the username is the one with local administrator rights and the computer name is a computer that is qualified to temporary remove the policy, then I need to execute a REG DELETE command with administrator rights.
       
      I hope I explained myself.
       
      Thank you very much.