Jump to content

ControlListView FindItem Issue


 Share

Recommended Posts

It seems that find item doesn't check for file extensions. This means that if I have two files with the same base name, only the first one is found.

Got any suggestions as how to fix this? (Showing file extensions is not an option).

Exmaple:

I got these files:

New File.jpg

New File.m2ts

New File.rw2

New File.xmp

ControlListView('xplorer', '', '[CLASS:ATL:BrowserListView; INSTANCE:3]', "FindItem", "New File") ; Returns the index only for New File.jpg

ControlListView('xplorer', '', '[CLASS:ATL:BrowserListView; INSTANCE:3]', "FindItem", "New File.jpg") ; Returns -1 because the column contains only the file base name and I'm searching for the file base name and extension.

Link to comment
Share on other sites

Something like this might work...

Global $sFile, $sExtension
$iCount = ControlListView("xplorer", "", "[CLASS:ATL:BrowserListView; INSTANCE:3]", "GetItemCount")
For $i = 0 To $iCount - 1
    $sFile = ControlListView("xplorer", "", "[CLASS:ATL:BrowserListView; INSTANCE:3]", "GetText", $i, 1) ; set last param to the correct subitem column
    $sExtension = ControlListView("xplorer", "", "[CLASS:ATL:BrowserListView; INSTANCE:3]", "GetText", $i, 2) ; set last param to the correct subitem column
    ConsoleWrite($i & @TAB & $sFile & $sExtension & @CRLF)
    If $sFile & $sExtension = "New File.jpg" Then
        ConsoleWrite("+ New File.jpg found, Index = " & $i & @CRLF)
    EndIf
Next
Edited by KaFu
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...