paul1965 Posted February 26, 2021 Share Posted February 26, 2021 Hi. I have a shared folder open on a PC that runs 24/7. The host PC that the folder resides on sleeps from 10PM to 7AM daily. On the PC the folder is open, the content changes to show my network once the host PC sleeps. Normally every morning I would then click the back button in Explorer to get the contents of the folder back, but I'd like to write a script and have AutoIt do that instead. Is that possible? I've tried a few different things like If $OpenExplorer = ("Network") Then Send, ("{ALT}{LEFT}") and FileSelectFolder but I have not been successful. Any tips would be greatly appreciated! Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2021 Share Posted February 26, 2021 Try to make a replicable runable snippet of the code you are having issue with. It would be easier for us to help you out this way. “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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 @Nine This is what I'm currently trying, but I keep getting an "error parsing function call" message. Sorry if it's not in the correct format... #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Restore folder after host resumes from sleep #ce ---------------------------------------------------------------------------- WinActivate ("Network") If WinActive ("Network") Then ControlSend, ("{ALT}{LEFT}") Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 This doesn't display an error, but it also doesn't appear to pass the ALT+Left arrow command, as my network is still displayed. If WinExists("Network") Then WinActivate("Network") Send ("{ALT}{LEFT}") Else EndIf Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2021 Share Posted February 26, 2021 That seems to be working fine : Const $sTitle = "Réseau" ; "Network" Local $hWnd If WinExists($sTitle) Then $hWnd = WinActivate($sTitle) WinWaitActive($hWnd) ControlSend ($hWnd, "", "", "!{LEFT}") EndIf “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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 @Nine Thank you for the reply, but I can't get that to work either. I can manually click the Explorer back button and get back to the folder contents, and I can also use the back button on my mouse. However the script doesn't appear to do anything as the network structure remains listed in the window. Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2021 Share Posted February 26, 2021 On which OS are you ? Maybe this : #RequireAdmin Const $sTitle = "Réseau" ; "Network" Local $hWnd If WinExists($sTitle) Then $hWnd = WinActivate($sTitle) ConsoleWrite ("Handle " & $hWnd & @CRLF) ConsoleWrite ("Wait " & WinWaitActive($hWnd) & @CRLF) ConsoleWrite ("Send " & ControlSend ($hWnd, "", "", "!{LEFT}") & @CRLF) EndIf Cause it is working fine 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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 (edited) I'm on Win 8.1 and there was no change with your latest script. I've tested it with the Explorer window minimized and opened. How are you testing it? Also, when I have the Explorer window open and run the script from Documents, I don't see the network window become activated (it's displaying it's background color). Should I see that change when WinActivate is called? Edited February 26, 2021 by paul1965 Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2021 Share Posted February 26, 2021 could you show the console after running my last script ? “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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 3 minutes ago, Nine said: could you show the console after running my last script ? I am not familiar with that. I am only running the script by right clicking and selecting "Run Script". Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2021 Share Posted February 26, 2021 Ah. Right click on the script and open/edit. You should be in Scite then. Make sure your Explorer is in Network. Come back to Scite and press F5. The console is at the bottom, enlarge to see all messages. Select all info, copy it and paste it 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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 Thanks for that info. Not much to show, but here it is: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Paul\Documents\RestoreFolder.au3" >Exit code: 0 Time: 1.073 Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2021 Share Posted February 26, 2021 (edited) Ok it seems it doesn't find the window Explorer in Network. You MUST be in the network otherwise it will not work. You could try to WinList() all your windows and _ArrayDisplay them all. You should see what is the problem. Please show all the Scite console with all version info (everything). Edited February 26, 2021 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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 (edited) I had previously verified that AutoIt finds the Explorer window with title "Network" and Handle 0x000F088A. I haven't used _ArrayDisplay but will try that next. Edited February 26, 2021 by paul1965 Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2021 Share Posted February 26, 2021 Paul, what version of Scite and AutoIt are you running. The code is NOT finding the window otherwise it would be displayed in the console. So do not tell me it does. You need to show me all Scite info. “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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 I'm running AutoIt Version 3.3.14.5, SciTE-Lite Version 3.5.4. WinList clearly found the window titled Network as shown in my screenshot, I never said the code found it. Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2021 Share Posted February 26, 2021 Download and install full version of Scite (4.2.0.0). If you want to create scripts, you absolutely need to run full version of Scite, this is essential. “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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 I've never used AHK before, but after just 43 minutes I have a working script that does exactly what I need. Thanks for your prompt responses @Nine Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2021 Developers Share Posted February 26, 2021 21 minutes ago, paul1965 said: I've never used AHK before, Me neither...why should we even when participating in this forum? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
paul1965 Posted February 26, 2021 Author Share Posted February 26, 2021 (edited) 26 minutes ago, Jos said: why should we even when participating in this forum? lol. I really wanted to use AutoIt. I wrote some scripts for Thunderbird to use for custom email notifications and they work fantastic. But for some reason the script refused to see the network folder. AHK saw it right away, restored it, clicked the back button, then minimized it using it's restored network folder name. The script has been converted to an .exe file and a task created to run it every morning. Edited February 26, 2021 by paul1965 Link to comment Share on other sites More sharing options...
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