artyb 0 Posted July 14, 2020 Share Posted July 14, 2020 Hi, Thank you for this great work. I'm new to this though and could do with a bit of help. I want to automate clicking on a mapped network drive in windows explorer. I found the 'Automating Windows Explorer' functions, but I'm not sure how to use them (or if that is the best way to do this?), despite some reading and searching. An example would be amazing. Thank you, A Link to post Share on other sites
Moderators JLogan3o13 1,769 Posted July 14, 2020 Moderators Share Posted July 14, 2020 @artyb what exactly are you trying to accomplish? Rather than just focusing on clicking on a mapped drive, what is the end goal (open a file, etc.)? By walking us through all of the steps you're trying to complete, we can better assist you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to post Share on other sites
argumentum 960 Posted July 14, 2020 Share Posted July 14, 2020 21 minutes ago, artyb said: I want to automate clicking on a mapped network drive in windows explorer. ..I guess "Welcome to AutoIt" You don't have to and should not, click around. "Windows Explorer" is a user interface to work with files, but in programming you don't use a graphic interface, you run/call commands, like FileCopy() or _WinAPI_CopyFileEx(). Do read around the forum and included help file ( from the standard AutoIt installer ). Doing so will show you how to do code what you need. Follow the link to see my signature's stuff.FAQ - Please Read Before Posting. Link to post Share on other sites
artyb 0 Posted July 14, 2020 Author Share Posted July 14, 2020 (edited) Thanks for the quick reply. The network drive connections get lost if the network is interrupted, or eg if the machine is put to sleep. I've got an existing batch script I made to ensure they reconnect, which I can run using AutoIt, but the explorer windows all show 'Computer' and that the network drives are not connected. Simply (single left) clicking on the network drive, then pressing the explorer 'back' button achieves the reconnection and the location being shown before the network was lost. I'm trying to automate this. I found a way to AutoIt the back button, but had to resort to mouse coordinates. Edited July 14, 2020 by artyb Typo Link to post Share on other sites
artyb 0 Posted July 14, 2020 Author Share Posted July 14, 2020 @argumentum I understand that typically is the case, but as my second post clarifies I'm trying to change the user interface. Link to post Share on other sites
argumentum 960 Posted July 14, 2020 Share Posted July 14, 2020 1 minute ago, artyb said: and the location being shown before the network was lost ..yeah, the icon may show as not connected in explorer until the path is explored, and only then it shows the proper icon. I never got to dig into that issue. Do post the solution once you find it. I'm sure it will be a most welcomed piece of code. Follow the link to see my signature's stuff.FAQ - Please Read Before Posting. Link to post Share on other sites
Nine 1,634 Posted July 14, 2020 Share Posted July 14, 2020 Have you tried using DriveMapDel / DriveMapAdd functions ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
artyb 0 Posted July 14, 2020 Author Share Posted July 14, 2020 No, but the drives ARE mapped, I'm just trying to update the Explorer windows. Link to post Share on other sites
Nine 1,634 Posted July 14, 2020 Share Posted July 14, 2020 Just unmap and remap them “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
Nine 1,634 Posted July 14, 2020 Share Posted July 14, 2020 But if you do not know what are the mappings cause it can change from computer to computer (or from time to time) : Local $hWnd = WinActivate("[CLASS:CabinetWClass]") ;MsgBox ($MB_SYSTEMMODAL,"",$hWnd) Local $hCtrl = ControlGetHandle($hWnd,"","ToolbarWindow321") ;MsgBox ($MB_SYSTEMMODAL,"",$hCtrl) Local $aPos = ControlGetPos ($hWnd, "", $hCtrl) ;_ArrayDisplay ($aPos) ControlClick ($hWnd, "", $hCtrl, "left", 1, $aPos[0]+$aPos[2]/3, $aPos[1]+$aPos[3]/2) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
artyb 0 Posted July 21, 2020 Author Share Posted July 21, 2020 (edited) Thanks for suggestions. I don't know what to do with the code you've posted though, and I'm not sure it will acheive what I'm trying to do? I'm trying to update existing open Explorer windows which 'don't realise' that the drives have been mapped. Thanks. A Edited July 21, 2020 by artyb Typo Link to post Share on other sites
artyb 0 Posted August 4, 2020 Author Share Posted August 4, 2020 Could you give an example of how this could be modified to step through all shared drives? Would it mean clicking on all locations, not only shared drives? Also explain why /3 for x coordinates and /2 for y? Thanks, A Link to post Share on other sites
Nine 1,634 Posted August 4, 2020 Share Posted August 4, 2020 (edited) This is simulating on Window Explorer a click to the back arrow. Since the control is the whole navigation toolbar (not just the back arrow), I need to estimate the coordinates where to click. Works fine with me on Win7 (untested on Win10). Use AutoIt info tool to get more information on Window Explorer controls. Edit : if you got multiple Window Explorer instances, you will need to loop thru each window (use WinList for that). Edited August 4, 2020 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
artyb 0 Posted August 4, 2020 Author Share Posted August 4, 2020 (edited) Ah. I'd already implemented that part in my script, my difficulty was simulating clicks on the shared drives which still show as disconnected in all of the explorer windows (and to some other software which checks for their presence before running backups), even though they are connected and the right hand side of the explorer window is showing the contents if the simulated click on back is to a shared drive. I need to click on each shared drive on the left hand side in order to get the windows to update the fact that they are reconnected. Thanks, A Edited August 4, 2020 by artyb Typo Link to post Share on other sites
Nine 1,634 Posted August 4, 2020 Share Posted August 4, 2020 Ok, I see what you want to do. If you had used AutoIt Info tool (as I already told you) for the left side of the Window Explorer screen, you would have seen that it is a TreeView control. You can easily manipulate a TreeView control with GUITreeView UDF. I know it can be done as I already have a script doing so. Try using the UDF, put something together and if you have trouble, just post what you got in here. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
artyb 0 Posted August 5, 2020 Author Share Posted August 5, 2020 (edited) I had tried the AutoIt info tool and also the UI Spy before posting. I had also found the Automating Windows Explorer UDF but didn't know how to use it and thought that may be a good way of doing this as people have had issues with automating Explorer. I'm new to AutoIt though, and posted in the Automating Windows Explorer UDF announcement thread, and was redirected here for advice. From memory I didn't spot anything I thought I could use with the info tool in that region (the whole area not individual drives), which is why I searched further and found the Automating Windows Explorer post. Might that UDF be a good way to do this? Alternatively knowing it's called a TreeView may help me in searching for examples. Thanks, A Edited August 5, 2020 by artyb Clarification Link to post Share on other sites
Nine 1,634 Posted August 5, 2020 Share Posted August 5, 2020 I never used Automating Windows Explorer UDF, so I cannot tell if it is working correctly or not. What I was suggesting is to use a built-in UDF that comes with AutoIt. GUITreeView UDF is totally fit to manipulate the left end side of Window Explorer. Look at _GUICtrlTreeView_FindItem to get to the Computer tree Then use _GUICtrlTreeView_GetFirstChild to get the first child of the Computer tree and loop thru with _GUICtrlTreeView_GetNextChild. Start learning those functions, experiment, run the examples, and try it on Window Explorer TreeView control handle. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now