Netol Posted June 22 Share Posted June 22 Hi my friends, How can I make code that selects all .jpg files in a folder in Windows Explorer. Reference image attached Link to comment Share on other sites More sharing options...
ioa747 Posted June 22 Share Posted June 22 https://www.autoitscript.com/autoit3/docs/libfunctions/_FileListToArray.htm Netol 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Solution KaFu Posted June 23 Solution Share Posted June 23 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 (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Netol Posted June 24 Author Share Posted June 24 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? Link to comment Share on other sites More sharing options...
Developers Jos Posted June 24 Developers Share Posted June 24 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. Link to comment Share on other sites More sharing options...
Werty Posted June 24 Share Posted June 24 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! Link to comment Share on other sites More sharing options...
Netol Posted June 25 Author Share Posted June 25 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 Link to comment Share on other sites More sharing options...
Netol Posted June 25 Author Share Posted June 25 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 Link to comment Share on other sites More sharing options...
Netol Posted June 25 Author Share Posted June 25 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 Link to comment Share on other sites More sharing options...
rudi Posted July 23 Share Posted July 23 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! Link to comment Share on other sites More sharing options...
Netol Posted July 23 Author Share Posted July 23 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 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