DOSHI Posted December 3, 2019 Share Posted December 3, 2019 Hello, I am new to auto it. I am trying to select all the images from a folder. Below is my script however it is not working. ControlFocus("Open","","Edit1") ControlSetText("Open","","Edit1","C:\Users\HP\Desktop\photos\") Send("{ENTER}") ControlGetHandle("Open","","DirectUIHWND") Send("^a") ControlClick("Open","","Button1") Thanks and Regards, Rupesh Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 3, 2019 Moderators Share Posted December 3, 2019 Moved to the appropriate forum. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Musashi Posted December 3, 2019 Share Posted December 3, 2019 (edited) 3 hours ago, DOSHI said: I am trying to select all the images from a folder. Could you describe in more detail what you want to achieve? There are probably better ways. Here's a snippet to mark all the files in a directory - maybe it already helps you a bit. Global $sPath = @DesktopDir & "\" ; <== replace with "C:\Users\HP\Desktop\photos\" Global $PID = ShellExecute(@WindowsDir & "\explorer.exe", "/n," & '"' & $sPath & '"') If Not @error Then Sleep(1000) Send("^a") EndIf Edited December 3, 2019 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
DOSHI Posted December 3, 2019 Author Share Posted December 3, 2019 Hello Musashi, Many thanks for your feedback. It helped me a lot. Need some more help to achieve my task. I am working on selenium with python 3.4.3. Actually I have some .jpg images in my folder kept at desktop. I want to transfer all file images to gmail photos album. So I was thinking that post naming the album I will select all the images from my desktop folder and then click ok. I am able to select one image at a time however was trying to select all the images and creating album at one go. I hope you understand what I am trying to do. Let me know if you need more information. Thanks and Regards, Rupesh Link to comment Share on other sites More sharing options...
Nine Posted December 3, 2019 Share Posted December 3, 2019 Try this : Global $sPath = @DesktopDir & "\Photos" Run(@WindowsDir & "\explorer.exe /n," & '"' & $sPath & '"') If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error loading Explorer") Sleep (1500) Global $hWnd = WinGetHandle ("[CLASS:CabinetWClass]", $sPath) If Not $hWnd Then Exit MsgBox ($MB_SYSTEMMODAL,"","Unable to find Explorer") ControlClick ($hWnd, "", "[CLASSNN:DirectUIHWND1]") ControlSend ($hWnd, "", "[CLASSNN:DirectUIHWND1]", "*.jpg") Sleep (1500) ControlClick ($hWnd, "", "[CLASSNN:DirectUIHWND3]") Send ("^a") “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...
DOSHI Posted December 4, 2019 Author Share Posted December 4, 2019 Hello Nine, Many thanks for your feedback. It's very useful. Further I am stuck in below points I want to click on the the class DirectUIHWN instance 2 as shown below to select 4 .jpg files as shown in above dialog box and then click open. For this below script is not working Global $sPath = @DesktopDir & "\Photos" ControlFocus("Open","","Edit1") ControlSetText("Open","","Edit1","C:\Users\HP\Desktop\photos\") Global $hWnd = WinGetHandle ("[CLASS:CabinetWClass]", $sPath) ControlClick ($hWnd, "", "[CLASS:DirectUIHWND2]") ControlSend ($hWnd, "", "[CLASS:DirectUIHWND2]", "*.jpg") Sleep (1500) ControlClick ($hWnd, "", "[CLASS:DirectUIHWND2]") send("^a") ControlClick("Open","","Button1") Please could you let me know where is the issue? Thanks and Regards, Rupesh Link to comment Share on other sites More sharing options...
DOSHI Posted December 4, 2019 Author Share Posted December 4, 2019 Hello Nine, Many thanks for your feedback. It's very useful. Further I am stuck in below points I want to click on the the class DirectUIHWN instance 2 as shown below to select 4 .jpg files as shown in above dialog box and then click open. For this below script is not working Global $sPath = @DesktopDir & "\Photos" ControlFocus("Open","","Edit1") ControlSetText("Open","","Edit1","C:\Users\HP\Desktop\photos\") Global $hWnd = WinGetHandle ("[CLASS:CabinetWClass]", $sPath) ControlClick ($hWnd, "", "[CLASS:DirectUIHWND2]") ControlSend ($hWnd, "", "[CLASS:DirectUIHWND2]", "*.jpg") Sleep (1500) ControlClick ($hWnd, "", "[CLASS:DirectUIHWND2]") send("^a") ControlClick("Open","","Button1") Please could you let me know where is the issue? Thanks and Regards, Rupesh Link to comment Share on other sites More sharing options...
DOSHI Posted December 4, 2019 Author Share Posted December 4, 2019 Hello, The script is now working fine. Thanks for looking into this so for.. Regards, Rupesh Link to comment Share on other sites More sharing options...
DOSHI Posted December 4, 2019 Author Share Posted December 4, 2019 Hello, The script is now working fine. Thanks for looking into this so for.. Regards, Rupesh 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