Jump to content

How can I make code that selects all .jpg files in a folder in Windows Explorer.


Go to solution Solved by KaFu,

Recommended Posts

  • Solution

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

 

Link to comment
Share on other sites

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

  • Developers
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

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

  • 4 weeks later...

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.

 

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...