LOADLIST command and UTF8 file lists

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: LOADLIST command and UTF8 file lists

Post by *Horst.Epp »

Currently I use a much faster workaround :D
Using the Ahk script for "Everything to XYplorer" and reading the resulting XY paper folder file with a LOADLIST button in TC.
The file format is UTF16 LE with Bom.
Of course this works only because I have XY running in the background.

The Ahk script must be changed to write the results directly into a file.

Code: Select all


; Build AutoHotkey_L
; Build x64
; Build Kill=true
; Build Zip=false
; Build Run=true

#NoEnv
#SingleInstance Force
SetBatchLines, -1

SetTitleMatchMode, RegEx

hWnd := WinExist("im) - Everything$ ahk_class EVERYTHING")
if hWnd {
    ControlGet, winContent, List, , SysListView321, % "ahk_id" hWnd
    if (winContent) {
        fullContent := ""

        ; Get only specific columns, not all!
        ; Path = 2nd column
        ; Name = 1st column
        getCols    := "2,1"
        getColsArr := StrSplit(getCols, ",")

        ; Loop over row(s)
        Loop, Parse, winContent, `n
        {
            rowID := A_Index
            path  := ""
            name  := ""
            full  := ""

            ; Loop over column(s)
            Loop, Parse, A_LoopField, % A_Tab
            {
                colID   := A_Index
                content := A_LoopField

                if (colID = getColsArr[1]) {
                    path := content
                } else if (colID = getColsArr[2]) {
                    name := content
                }
            }
            if (path && name) {
                full := path "\" name
                fullContent .= full "<::>"
            } else if (path) {
                full := path
                fullContent .= full "<::>"
            }
        }
        if (fullContent)
            fullContent := SubStr(fullContent, 1, StrLen(fullContent) - StrLen("<::>"))

        xyHWnd := WinExist("ahk_class ThunderRT6FormDC")
        if (xyHWnd) {
            xyQueryScript =
            ( LTrim Join
                ::$content = replace("%fullContent%", "<::>", <crlf>);
                    tab("new");
                    paperfolder("paper:Everything", $content, , "nl");
            )
            Send_WM_COPYDATA(xyQueryScript, xyHWnd)
        }
    }
}
run "C:\Tools\Everything\Everything64.exe" -close
return


; ====================================
; = GOTO: FUNCTIONS - Send_WM_COPYDATA
; ====================================
Send_WM_COPYDATA(message, hWnd) {
    size := StrLen(message)
    if !(A_IsUnicode) {
        VarSetCapacity(data, size * 2, 0)
        StrPut(message, &data, size, "UTF-16")
    } else {
        data := message
    }
    VarSetCapacity(COPYDATA, A_PtrSize * 3, 0)
    NumPut(4194305, COPYDATA, 0, "Ptr")
    NumPut(size * 2, COPYDATA, A_PtrSize, "UInt")
    NumPut(&data, COPYDATA, A_PtrSize * 2, "Ptr")
    result := DllCall("User32.dll\SendMessageW", "Ptr", hWnd, "UInt", 74, "Ptr", 0, "Ptr", &COPYDATA, "Ptr")
    return
}

Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: LOADLIST command and UTF8 file lists

Post by *Horst.Epp »

I have sent a mail with sample files and error messages from LOADLIST command
to Christians support address.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: LOADLIST command and UTF8 file lists

Post by *petermad »

Horst.Epp wrote: 2021-10-08, 17:34 UTC I have sent a mail with sample files and error messages from LOADLIST command
to Christians support address.
Any chance that you could maybe share that list?
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: LOADLIST command and UTF8 file lists

Post by *Horst.Epp »

Its a simple list of dirs formatted as UTF 16 LE with Bom.
I have sent it by mail in an archive to preserve the real format.
Also included the strange error message which says

Code: Select all

---------------------------
<Error!>
---------------------------
File not found! (36x)
1und1
Adguard
Adobe
AkelPad
Android
...
---------------------------
OK
---------------------------

Code: Select all

C:\Temp\Download\1und1
C:\Temp\Download\Adguard
C:\Temp\Download\Adobe
C:\Temp\Download\AkelPad
C:\Temp\Download\Android
C:\Temp\Download\Apple
C:\Temp\Download\Autohotkey
C:\Temp\Download\AVM
C:\Temp\Download\Chrome
C:\Temp\Download\ct
C:\Temp\Download\Dell
C:\Temp\Download\EPIM
C:\Temp\Download\Everything
C:\Temp\Download\Firefox
C:\Temp\Download\Google
C:\Temp\Download\HP
C:\Temp\Download\Kaspersky
C:\Temp\Download\Keepass
C:\Temp\Download\Kindle
C:\Temp\Download\AVM\Labor
C:\Temp\Download\Logitech
C:\Temp\Download\Macrium
C:\Temp\Download\Oracle
C:\Temp\Download\PowerShell
C:\Temp\Download\Rainlendar
C:\Temp\Download\Samsung
C:\Temp\Download\Security
C:\Temp\Download\TC
C:\Temp\Download\Thunderbird
C:\Temp\Download\TV-Browser
C:\Temp\Download\VMware
C:\Temp\Download\W8
C:\Temp\Download\W10
C:\Temp\Download\W11
C:\Temp\Download\W10\Winhlp
C:\Temp\Download\WinPE
C:\Temp\Download\WinRAR
C:\Temp\Download\XYplorer
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
NotNull
Senior Member
Senior Member
Posts: 266
Joined: 2019-11-25, 20:43 UTC
Location: NL

Re: LOADLIST command and UTF8 file lists

Post by *NotNull »

Confirmed. (just generated these exact same foldrs and exported as an UTF8 encode list)

However ....
  • 2 Folders *are* shown, Those are the ones that are one level deeper.
    (C:\temp\Download\W10\Winhlp and C:\temp\Download\AVM\Labor)
  • When a trailing backslash is added to the 36 missing folders, those are added to the listbox too. No more errors.
Smells like a bug to me.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: LOADLIST command and UTF8 file lists

Post by *Horst.Epp »

2NotNull
Yes, its a bug in LOADLIST.
Unfortunately it can only be fixed in TC
as we can't know what enries are folders or files from the Everything results.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
NotNull
Senior Member
Senior Member
Posts: 266
Joined: 2019-11-25, 20:43 UTC
Location: NL

Re: LOADLIST command and UTF8 file lists

Post by *NotNull »

Horst.Epp wrote: 2021-10-08, 20:03 UTC as we can't know what enries are folders or files from the Everything results.
Never underestimate Everything! ;)
It is on the Everything to-do list to export foldernames with a trailing backslash.

But I agree: this should get fixed on the TC side.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: LOADLIST command and UTF8 file lists

Post by *Horst.Epp »

Here my steps for automatic loading an Everything results file
with TCs LOADLIST from an external script.

1. Create a sub-dir inside of TC home for just this purpose.

2. Create em_LoadEvResult in Usercmd.ini
with command LOADLIST and as parameter the full path-name of the Everything results file.

3 Create a View mode named Ev_Results which sets the Columns view to Branch View
and the Auto-run command to em_LoadEvResult

4 Create an Auto Switch mode which triggers when the dir from step 1 is opened
and sets the View mode Ev_Results

The script which created the Everything result can now finally
execute Total Commander with the parameters /O /T /S Path_to_Dir_from_Step1
LOADLIST is started and the results are displayed without any further user action.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: LOADLIST command and UTF8 file lists

Post by *ghisler(Author) »

It's not a bug in LOADLIST, it just expects that folders end in a backslash, as when you create the list with Total Commander itself.
I will add some code to check whether a name is a directory when there is no trailing backslash, and no file is found with that name.
Author of Total Commander
https://www.ghisler.com
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: LOADLIST command and UTF8 file lists

Post by *Horst.Epp »

ghisler(Author) wrote: 2021-10-12, 08:25 UTC It's not a bug in LOADLIST, it just expects that folders end in a backslash, as when you create the list with Total Commander itself.
I will add some code to check whether a name is a directory when there is no trailing backslash, and no file is found with that name.
Ok, thanks.
We have now a work around in the Everything script which does this check and adds \ for dirs.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
NotNull
Senior Member
Senior Member
Posts: 266
Joined: 2019-11-25, 20:43 UTC
Location: NL

Re: LOADLIST command and UTF8 file lists

Post by *NotNull »

ghisler(Author) wrote: 2021-10-12, 08:25 UTC It's not a bug in LOADLIST, it just expects that folders end in a backslash, as when you create the list with Total Commander itself.
I will add some code to check whether a name is a directory when there is no trailing backslash, and no file is found with that name.
That doesn't explain why some folders *don't* need a trailing backslash.
For example: Horst's lists contains 38 folders and 36 errors. 2 Folders are shown (see previous post).
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: LOADLIST command and UTF8 file lists

Post by *petermad »

2NotNull
For example: Horst's lists contains 38 folders and 36 errors. 2 Folders are shown (see previous post).
The two folders that are shown are parent folders C:\Temp\Download\AVM and C:\Temp\Download\W10 and they are found by TC when recursing the path of each entry in the list.

The list contains:

Code: Select all

C:\Temp\Download
C:\Temp\Download\AVM
and

Code: Select all

C:\Temp\Download\W10
C:\Temp\Download\AVM\Labor
so for example C:\Temp\Download is not shown, but the parent folder to C:\Temp\Download\AVM is shown beceause it is C:\Temp\Download\
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
NotNull
Senior Member
Senior Member
Posts: 266
Joined: 2019-11-25, 20:43 UTC
Location: NL

Re: LOADLIST command and UTF8 file lists

Post by *NotNull »

Not sure If I understood correctly, but following that reasoning would mean that adding C:\Temp\Download to Horst's list would show all 38 folders.

That is not the case : the aforementioned two folders are shown, as well as the newly added c:\download folder (without trailing \, btw !!).
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: LOADLIST command and UTF8 file lists

Post by *petermad »

2NotNull

When TC reads the C:\Temp\Download\AVM line it recognizes the C:\Temp\Download\ folder as existing, hence shows it.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: LOADLIST command and UTF8 file lists

Post by *ghisler(Author) »

TC uses two strategies when reading LOADLIST:
1. When there are less than 10 elements from a certain directory, TC calls FindFirstFile for each of them separately. This finds both files and folders.
2. When there are 10 or more elements from a directory, TC reads that entire directory into memory via FindFirstFile/FindNextFile. Then it checks whether the name is part of the list to gets the size, attributes etc. In this second case, it matters whether the element is a file or a folder because they are sorted separately.
Author of Total Commander
https://www.ghisler.com
Post Reply