Sign in to follow this  
Followers 0
ineedh3lp

ControlListView FindItem Issue

3 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Adjusted the subitem columns (1 to 0 and 2 to 1), added the dot in If $sFile & '.' & $sExtension = "New File.jpg" Then and it did the trick. Thank you once again for helping me!

Edited by ineedh3lp

Share this post


Link to post
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
Sign in to follow this  
Followers 0