Netol Posted June 22, 2024 Posted June 22, 2024 Hi my friends, How can I make code that selects all .jpg files in a folder in Windows Explorer. Reference image attached
ioa747 Posted June 22, 2024 Posted June 22, 2024 https://www.autoitscript.com/autoit3/docs/libfunctions/_FileListToArray.htm Netol 1 I know that I know nothing
Solution KaFu Posted June 23, 2024 Solution Posted June 23, 2024 The example zip in this excellent UDF by @LarsJ contains all required includes. This code will select all jpgs in the topmost Windows Explorer window. #include "Includes\AutomatingWindowsExplorer.au3" #include <Array.au3> Opt("MustDeclareVars", 1) Example() Func Example() ; Windows Explorer on XP, Vista, 7, 8 Local $hExplorer = WinGetHandle("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Automating Windows Explorer", "Could not find Windows Explorer. Terminating.") Return EndIf ; Get an IShellBrowser interface GetIShellBrowser($hExplorer) If Not IsObj($oIShellBrowser) Then MsgBox(0, "Automating Windows Explorer", "Could not get an IShellBrowser interface. Terminating.") Return EndIf ; Get other interfaces GetShellInterfaces() ; Get all items with full path Local $aFiles = GetItems(False, True) ; _ArrayDisplay( $aFiles, "All files" ) For $i = 0 To UBound($aFiles) - 1 If StringRight($aFiles[$i], 4) = ".jpg" Then SetSelectedItem($i) Next EndFunc ;==>Example Netol 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Netol Posted June 24, 2024 Author Posted June 24, 2024 13 hours ago, KaFu said: The example zip in this excellent UDF by @LarsJ contains all required includes. This code will select all jpgs in the topmost Windows Explorer window. #include "Includes\AutomatingWindowsExplorer.au3" #include <Array.au3> Opt("MustDeclareVars", 1) Example() Func Example() ; Windows Explorer on XP, Vista, 7, 8 Local $hExplorer = WinGetHandle("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Automating Windows Explorer", "Could not find Windows Explorer. Terminating.") Return EndIf ; Get an IShellBrowser interface GetIShellBrowser($hExplorer) If Not IsObj($oIShellBrowser) Then MsgBox(0, "Automating Windows Explorer", "Could not get an IShellBrowser interface. Terminating.") Return EndIf ; Get other interfaces GetShellInterfaces() ; Get all items with full path Local $aFiles = GetItems(False, True) ; _ArrayDisplay( $aFiles, "All files" ) For $i = 0 To UBound($aFiles) - 1 If StringRight($aFiles[$i], 4) = ".jpg" Then SetSelectedItem($i) Next EndFunc ;==>Example Thank you my friend. How can I put the route I need in this code?
Developers Jos Posted June 24, 2024 Developers Posted June 24, 2024 On 6/22/2024 at 11:56 PM, Netol said: How can I make code that selects all .jpg files in a folder in Windows Explorer. What is wrong with Ctrl+A ? 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.
Werty Posted June 24, 2024 Posted June 24, 2024 1 hour ago, Jos said: What is wrong with Ctrl+A ? CTRL+A selects ALL files, not just .jpg's. Jos 1 Some guy's script + some other guy's script = my script!
Netol Posted June 25, 2024 Author Posted June 25, 2024 14 hours ago, Jos said: What is wrong with Ctrl+A ? I can't use Ctrl+A because there are different files in each folder
Netol Posted June 25, 2024 Author Posted June 25, 2024 14 hours ago, Jos said: What is wrong with Ctrl+A ? I can't use Ctrl+A because there are different files in each folder
Netol Posted June 25, 2024 Author Posted June 25, 2024 On 6/23/2024 at 8:58 AM, KaFu said: The example zip in this excellent UDF by @LarsJ contains all required includes. This code will select all jpgs in the topmost Windows Explorer window. #include "Includes\AutomatingWindowsExplorer.au3" #include <Array.au3> Opt("MustDeclareVars", 1) Example() Func Example() ; Windows Explorer on XP, Vista, 7, 8 Local $hExplorer = WinGetHandle("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Automating Windows Explorer", "Could not find Windows Explorer. Terminating.") Return EndIf ; Get an IShellBrowser interface GetIShellBrowser($hExplorer) If Not IsObj($oIShellBrowser) Then MsgBox(0, "Automating Windows Explorer", "Could not get an IShellBrowser interface. Terminating.") Return EndIf ; Get other interfaces GetShellInterfaces() ; Get all items with full path Local $aFiles = GetItems(False, True) ; _ArrayDisplay( $aFiles, "All files" ) For $i = 0 To UBound($aFiles) - 1 If StringRight($aFiles[$i], 4) = ".jpg" Then SetSelectedItem($i) Next EndFunc ;==>Example Thanks a lot, i used this code and working fine This code work with the active windows explorer Best regards
rudi Posted July 23, 2024 Posted July 23, 2024 Hello, in case you finally want to have the JPG files collection in your clipboard, take a look at the fuction _ClipPutFile() This one has the advantage, that you can even put multiple files into the clipboard, that are spread across multiple folders. CU, Rudi. Netol 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Netol Posted July 23, 2024 Author Posted July 23, 2024 6 hours ago, rudi said: Hello, in case you finally want to have the JPG files collection in your clipboard, take a look at the fuction _ClipPutFile() This one has the advantage, that you can even put multiple files into the clipboard, that are spread across multiple folders. CU, Rudi. Thanks a lot for your tip best regards
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