Open Everything GUI results with TC LOADLIST

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
tuska
Power Member
Power Member
Posts: 4083
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

AntonyD wrote: 2025-05-18, 13:04 UTC And I've got all which I described above: lines for records for C:/ and D:/ partition were loaded and shown
Record from E:/ partition - was not. And no any errors were faced during this op.
...
See also the follow-up to the previous post in the “TC11.x bug reports (English)” forum:
LOADLIST does not load records about files on partition E:\
User avatar
tuska
Power Member
Power Member
Posts: 4083
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

Everything 1.5.0.1391a (x64)

Code: Select all

files: attributes:a
Footer of Everything: 657 266 items (657 266 files, 0 folders)
SEND_EV-RESULTS_to_TC-panel_(A)_CloseEverything-0_TAB-Search_result_(A).exe wrote:
Error: Memory limit reached (see #MaxMem in the help file).

Line#
---> 124: fullContent .= full "
"

The current thread will exit.
The file “C:\totalcmd\EV-Results\EV-Results.txt” remained unchanged, i.e., no update took place
and the TC “Search result:” tab did not appear.

(I already addressed this topic here once before).

2Ovg (or other AHK specialists)
Can anything be done here in the AHK script?

Note:
- TC Find Files (separate): ev:files: attributes:a
- Shift+Feed to listbox -> Tab "Search result:" -> Works!
SEND_EV-RESULTS_to_TC-panel_(A)_CloseEverything-0_TAB-Search_result_(A).ahk

Code: Select all

; Transfer Everything GUI results to TC
; Authors: Horst.Epp & Ovg
; Last modified: 04.10.2022 (Updated for TC 10.52 RC1)

; https://www.ghisler.ch/board/viewtopic.php?t=75439 ...... Open Everything GUI results with TC LOADLIST
; https://www.ghisler.ch/board/viewtopic.php?t=75417 ...... LOADLIST command and UTF8 file lists
; https://www.voidtools.com/forum/viewtopic.php?f=4&t=10594 Send ResultsList to Total Commander

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

#NoEnv
;#Persistent
#SingleInstance Force
SetBatchLines, -1

; Create / read .ini file settings
SetTitleMatchMode, RegEx
iniFile := RegExReplace(A_ScriptFullPath, "(ahk|exe)$", "ini")

if not (FileExist(iniFile)) {
    iniContent :="
    (( LTrim
        [General]
	; DestinationFile
        ;    Where to save the output (full path to DestinationFile.txt)
        ; EverythingColumnPositions (Default: 2,1)
	;    The columns 'Name' and 'Path' must be visible in the Everything GUI Window
        ;    The first value is the position of the 'Path' column
        ;    The second value is the position of the 'Name' column
	; CloseEverything (Default 1 for yes)
	;    Should Everything GUI window be closed after transfering to TC
	; UseInstance (Empty for default instance)
        ;    Name of the Everything instance to be used for closing the GUI

; The contents of the following lines must be adjusted if necessary, e.g. path and parameter adjustments.
;********************************************************************************************************
        DestinationFile = C:\totalcmd\EV-Results\EV-Results.txt
        EverythingColumnPositions=2,1
        AddEndSlash =1
        CloseEverything =0
        UseInstance =
        Everything = C:\Everything\Everything64.exe
        TotalCmd = C:\totalcmd\TOTALCMD64.EXE
;********************************************************************************************************

    )"
    FileAppend, % iniContent, % iniFile, UTF-16
}
IniRead, DestinationFile, % iniFile, General, DestinationFile, %A_Space%
IniRead, EverythingColumnPositions, % iniFile, General, EverythingColumnPositions, 2`,1

IniRead, AddEndSlash, % iniFile, General, AddEndSlash, 1
IniWrite, %AddEndSlash%, % iniFile, General, AddEndSlash
IniRead, CloseEverything, % iniFile, General, CloseEverything, 1
IniWrite, %CloseEverything%, % iniFile, General, CloseEverything
IniRead, UseInstance, % iniFile, General, UseInstance, %A_Space%
IniWrite, %UseInstance%, % iniFile, General, UseInstance

IniRead, Everything, % iniFile, General, Everything, "C:\Everything\Everything64.exe"
IniRead, TotalCmd, % iniFile, General, TotalCmd, "C:\totalcmd\TOTALCMD64.EXE"

DestinationFile           := ResolveEnvVars(DestinationFile)
EverythingColumnPositions := StrReplace(EverythingColumnPositions, " ")

; Force error if none is given (or path doesn't exist)
SplitPath, DestinationFile, , dstPath
if (DestinationFile = "" || !InStr(FileExist(dstPath), "D")) {
    Msgbox, 16, Fatal error, Destination file definition is missing or illegal named !
    Return
}
if (EverythingColumnPositions = "" || !InStr(EverythingColumnPositions, ",")) {
    EverythingColumnPositions := "2,1"
}

columnArray := StrSplit(EverythingColumnPositions, ",")

hWnd := WinExist("ahk_exe Everything(?:\d\d)*\.exe")

if hWnd
{
  ControlGet, winContent, List, , SysListView321, % "ahk_id" hWnd

  if (winContent)
  {
    fullContent := ""
;   Loop over row(s)
    Loop, Parse, winContent, `n
    {
      rowID := A_Index
      path  := ""
      name  := ""
      full  := ""
      Bad := 2
;     Loop over column(s)
      Loop, Parse, A_LoopField, % A_Tab
      {
        colID   := A_Index
        content := A_LoopField
        If (colID > columnArray[1] And colID > columnArray[2])
        {
          Break
        }
        Else
        {
          If (colID = columnArray[1])
          {
;	    If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")
	    If !RegExMatch(content,"i)^(?:[a-z]:|\\\.*?\\)")
            {
              Break
            }
            path := content
            Bad -= 1
            If !RegExMatch(path,"\\$")
            {
              path := path . "\"
            }
          }
          Else if (colID = columnArray[2])
          {
            If content is Space
            {
              Break
            }
            name := content
            Bad -= 1
          }
        }
      }
      If (Bad == 0)
      {
        full        := path . name
        If InStr(FileExist(full), "D")
        {
          if (AddEndSlash == 1)
          {
            if !RegExMatch(full,"\\$")
            {
              full := full . "\"
            }
          }
          Else
          {
            If RegExMatch(full,"\\$")
            {
              full := SubStr(full,1,StrLen(full)-1)
            }
          }
        }
        fullContent .= full "`n"
      }
    }
    fullContent := RegExReplace(fullContent,"\R$","")
    If (FileExist(DestinationFile))
      FileDelete, % DestinationFile

        FileAppend, % fullContent, % DestinationFile, UTF-16

	DestinationDir := SubStr(DestinationFile,1,InStr(DestinationFile, "\",,-1))
	Run %TotalCmd% /O /T /S LOADLIST:%DestinationFile%
	If (CloseEverything) {
             run %Everything% -instance "%UseInstance%" -close
	}
    }
    Else
;   Empty search result
    {
      Msgbox, 16,, Search result is Empty, Nothing to do ...
    }
; No Everything window visible
} Else {
    Msgbox, 16, Fatal error, Everything window does not exist!
}
SetTitleMatchMode, 1
return

; ==================================
; = GOTO: FUNCTIONS - ResolveEnvVars
; ==================================
; http://www.autohotkey.com/board/topic/40115-func-envvars-replace-environment-variables-in-text/#entry310601
ResolveEnvVars(str) {
    if sz := DllCall("ExpandEnvironmentStrings", "uint", &str, "uint", 0, "uint", 0)
    {
        VarSetCapacity(dst, A_IsUnicode ? sz * 2 : sz)
        if DllCall("ExpandEnvironmentStrings", "uint", &str, "str", dst, "uint", sz)
            return dst
    }
    return str
}
Windows 11 Pro (x64) Version 24H2 (OS build 26100.4061) - Latest revision date: 2025-05-13
https://aka.ms/Windows11/ReleaseInfo
; https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information

Code: Select all

Sources	 		msinfo32.exe (System Information), Windows logo key + Pause key (System > About), Search: winver[.exe], Task-Manager
.
OS Name			Microsoft Windows 11 Pro
Version			10.0.26100 Build 26100
Processor		Intel(R) Core(TM) i5-12600K 12th Gen, 3.70 GHz, 10 Cores, 16 Logical Processors
Installed RAM		32.0 GB (22.2 GB physical memory usable) | Task-Manager - RAM usage: ≈30%
System type		64-bit operating system, x64-based processor

Edition			Windows 11 Pro
Version			24H2
Installed on		22/11/2024
OS build		26100.4061
Experience		Windows Feature Experience Pack 1000.26100.84.0
User avatar
AntonyD
Power Member
Power Member
Posts: 1636
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Open Everything GUI results with TC LOADLIST

Post by *AntonyD »

2tuska
as I see you did not changed this line:

Code: Select all

hWnd := WinExist("ahk_exe Everything(?:\d\d)*\.exe")
as I suggested earlier:

Code: Select all

hWnd := WinExist("ahk_exe Everything(?:\d\d)*\.exe ahk_class EVERYTHING")
In the later added just improvement of the ability to find a real HWND value of a real window of EVERYTHING64.exe
This is about the same situation as in my other bug.
We've never seen such a thing as active hidden windows in a list of windows linked to a process.
So here, if you call this script without my addition at the end, you will get the HWND from another hidden window, which
is in the list above the one we really need. And with my addition, we will get what we are looking for in 100% of cases.
Last edited by AntonyD on 2025-05-23, 12:12 UTC, edited 1 time in total.
#146217 personal license
User avatar
AntonyD
Power Member
Power Member
Posts: 1636
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Open Everything GUI results with TC LOADLIST

Post by *AntonyD »

As to this bug try to use:

Code: Select all

FileAppend, % full "`n", % DestinationFile, UTF-16
against of line

Code: Select all

fullContent .= full "`n"
but of course create a proper empty file BEFORE entrance in this Loop over row(s):

Code: Select all

if (FileExist(DestinationFile))
  FileDelete, % DestinationFile
FileAppend,, % DestinationFile, UTF-16

Code: Select all

fullContent := RegExReplace(fullContent,"\R$","")
this line can also be removed at all.
as and this:

Code: Select all

fullContent := ""
#146217 personal license
User avatar
AntonyD
Power Member
Power Member
Posts: 1636
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Open Everything GUI results with TC LOADLIST

Post by *AntonyD »

ok, here is the full code:
Spoiler

Code: Select all

; Transfer Everything GUI results to TC
; Authors: Horst.Epp & Ovg
; Last modified: 04.10.2022 (Updated for TC 10.52 RC1)

; https://www.ghisler.ch/board/viewtopic.php?t=75439 ...... Open Everything GUI results with TC LOADLIST
; https://www.ghisler.ch/board/viewtopic.php?t=75417 ...... LOADLIST command and UTF8 file lists
; https://www.voidtools.com/forum/viewtopic.php?f=4&t=10594 Send ResultsList to Total Commander

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

#NoEnv
;#Persistent
#SingleInstance Force
SetBatchLines, -1

; Create / read .ini file settings
SetTitleMatchMode, RegEx
iniFile := RegExReplace(A_ScriptFullPath, "(ahk|exe)$", "ini")

if not (FileExist(iniFile)) {
    iniContent :="
    (( LTrim
        [General]
	; DestinationFile
        ;    Where to save the output (full path to DestinationFile.txt)
        ; EverythingColumnPositions (Default: 2,1)
	;    The columns 'Name' and 'Path' must be visible in the Everything GUI Window
        ;    The first value is the position of the 'Path' column
        ;    The second value is the position of the 'Name' column
	; CloseEverything (Default 1 for yes)
	;    Should Everything GUI window be closed after transfering to TC
	; UseInstance (Empty for default instance)
        ;    Name of the Everything instance to be used for closing the GUI

; The contents of the following lines must be adjusted if necessary, e.g. path and parameter adjustments.
;********************************************************************************************************
        DestinationFile = C:\totalcmd\EV-Results\EV-Results.txt
        EverythingColumnPositions=2,1
        AddEndSlash =1
        CloseEverything =0
        UseInstance =
        Everything = C:\Everything\Everything64.exe
        TotalCmd = C:\totalcmd\TOTALCMD64.EXE
;********************************************************************************************************

    )"
    FileAppend, % iniContent, % iniFile, UTF-16
}
IniRead, DestinationFile, % iniFile, General, DestinationFile, %A_Space%
IniRead, EverythingColumnPositions, % iniFile, General, EverythingColumnPositions, 2`,1

IniRead, AddEndSlash, % iniFile, General, AddEndSlash, 1
IniWrite, %AddEndSlash%, % iniFile, General, AddEndSlash
IniRead, CloseEverything, % iniFile, General, CloseEverything, 1
IniWrite, %CloseEverything%, % iniFile, General, CloseEverything
IniRead, UseInstance, % iniFile, General, UseInstance, %A_Space%
IniWrite, %UseInstance%, % iniFile, General, UseInstance

IniRead, Everything, % iniFile, General, Everything, "C:\Everything\Everything64.exe"
IniRead, TotalCmd, % iniFile, General, TotalCmd, "C:\totalcmd\TOTALCMD64.EXE"

DestinationFile           := ResolveEnvVars(DestinationFile)
EverythingColumnPositions := StrReplace(EverythingColumnPositions, " ")

; Force error if none is given (or path doesn't exist)
SplitPath, DestinationFile, , dstPath
if (DestinationFile = "" || !InStr(FileExist(dstPath), "D")) {
    Msgbox, 16, Fatal error, Destination file definition is missing or illegal named !
    Return
}
if (EverythingColumnPositions = "" || !InStr(EverythingColumnPositions, ","))
    EverythingColumnPositions := "2,1"

columnArray := StrSplit(EverythingColumnPositions, ",")

hWnd := WinExist("ahk_exe Everything(?:\d\d)*\.exe ahk_class EVERYTHING")

if hWnd
{
  ControlGet, winContent, List, , SysListView321, % "ahk_id" hWnd

  if (winContent)
  {
;   Loop over row(s)
    if (FileExist(DestinationFile))
      FileDelete, % DestinationFile
    FileAppend,, % DestinationFile, UTF-16

    Loop, Parse, winContent, `n
    {
      rowID := A_Index
      path  := ""
      name  := ""
      full  := ""
      Bad := 2
;     Loop over column(s)
      Loop, Parse, A_LoopField, % A_Tab
      {
        colID   := A_Index
        content := A_LoopField
        If (colID > columnArray[1] And colID > columnArray[2])
        {
          Break
        }
        Else
        {
          If (colID = columnArray[1])
          {
;            If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")
            If !RegExMatch(content,"i)^(?:[a-z]:|\\\.*?\\)")
            {
              Break
            }
            path := content
            Bad -= 1
            If !RegExMatch(path,"\\$")
            {
              path := path . "\"
            }
          }
          Else if (colID = columnArray[2])
          {
            If content is Space
            {
              Break
            }
            name := content
            Bad -= 1
          }
        }
      }
      If (Bad == 0)
      {
        full := path . name
        If InStr(FileExist(full),"D")
        {
          if (AddEndSlash == 1)
          {
            if !RegExMatch(full,"\\$")
            {
              full := full . "\"
            }
          }
          Else
          {
            If RegExMatch(full,"\\$")
            {
              full := SubStr(full,1,StrLen(full)-1)
            }
          }
        }
        FileAppend, % full "`n", % DestinationFile, UTF-16
      }
    }

	DestinationDir := SubStr(DestinationFile,1,InStr(DestinationFile,"\",,-1))
	Run %TotalCmd% /O /T /S LOADLIST:%DestinationFile%
	If (CloseEverything)
	  run %Everything% -instance "%UseInstance%" -close
;  Empty search result
  } Else {
	Msgbox, 16, , Search result is Empty, Nothing to do ...
  }
; No Everything window visible
} Else {
  Msgbox, 16, Fatal error, Everything window does not exist!
}
SetTitleMatchMode, 1
return

; ==================================
; = GOTO: FUNCTIONS - ResolveEnvVars
; ==================================
; http://www.autohotkey.com/board/topic/40115-func-envvars-replace-environment-variables-in-text/#entry310601
ResolveEnvVars(str)
{
	if sz := DllCall("ExpandEnvironmentStrings", "uint", &str, "uint", 0, "uint", 0)
	{
		VarSetCapacity(dst, A_IsUnicode ? sz * 2 : sz)
		if DllCall("ExpandEnvironmentStrings", "uint", &str, "str", dst, "uint", sz)
			return dst
	}
	return str
}
#146217 personal license
User avatar
tuska
Power Member
Power Member
Posts: 4083
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

2AntonyD
Thanks for your efforts!

I tried to incorporate your code, but without success
(only the “Search result:” tab appeared and the “EV-Results.txt” file was empty).

After that, I wanted to suggest that you incorporate your changes into the script,
because topics like this usually give me a terrible headache ;-) ... (no programming skills).

But you had already provided the corrected AHK script.

Here is the result:
Transferring the search results (large number of files) from Everything to Total Commander
takes SIGNIFICANTLY LONGER than with the previous script and is still running:

52 minutes and the file “C:\totalcmd\EV-Results\EV-Results.txt” keeps getting bigger.
Currently: ≈23 MB for 657,451 files

Something seems to be wrong here...

PS:
I have now finished (Exit) the AHK script at 23.6 MB.
Incidentally, the file “C:\totalcmd\EV-Results\EV-Results.txt” only had 102,876 lines/files at this point.

PPS:
I have started another attempt.
Last edited by tuska on 2025-05-23, 14:10 UTC, edited 1 time in total.
User avatar
AntonyD
Power Member
Power Member
Posts: 1636
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Open Everything GUI results with TC LOADLIST

Post by *AntonyD »

In general, this is certainly strange behavior because the change I made is simply a guaranteed immediate write to the file of the lines that were obtained from the syslistview32 in the EVERYTHING utility.
As for speed, my initial query inside this utility took more than 7 minutes and consumed almost 60% of the memory!
Obviously, since the code FIRST needs to get all the entries from the syslistview32 , obtaining such a huge number of lines cannot be instantaneous.
And only AFTER that will there be an attempt to open Total with a new tab and output the list there.

If I were you, I would open the file in an editor that allows you to always track the end of the file and monitor in real time what entries are being written there. And in what quantity. You can now open this file and compare its entries with the list that EVERYTHING made after executing the query?
And another thing - doesn't such a large number of files in the Total panel scare you?
Are you even sure that it will be able to display that many?

I found about 700,000 suitable A-files. The final txt file took up about 85MB!!!!
And the most time-consuming part took place within a single line of code::

Code: Select all

ControlGet, winContent, List, , SysListView321, % "ahk_id" hWnd
That is, the main problem lies within the engine's code itself.
It is not optimized for retrieving such a large amount of data from a window object simultaneously - in our case, from its syslistview32.
#146217 personal license
User avatar
tuska
Power Member
Power Member
Posts: 4083
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

AntonyD wrote: 2025-05-23, 14:08 UTC And another thing - doesn't such a large number of files in the Total panel scare you?
Are you even sure that it will be able to display that many?
The next test run has already been running for 60 minutes (24.4 MB) and the EV-Results.txt file is being updated continuously.

I'm not alarmed by the large number of files, as I want to TEST a large number of files and,
most importantly, no longer see the message regarding “Memory limit”.

Let's wait and see...
User avatar
AntonyD
Power Member
Power Member
Posts: 1636
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Open Everything GUI results with TC LOADLIST

Post by *AntonyD »

I think using the AHK engine to transfer that such much memory data to the final file-list is a bit much a heavy-handed
approach to solving a problem.
IMHO, it will be better if you can check more reasonable variants of working with the script, when the list in total
will be no more than 1000 records - this IMHO is the most adequate size of search results with good optimization of the search itself.
The main thing is just to make sure the new code works. And stable. But on an average number of records. Not at this maximum.
BUT there is one plus - with this a new code-approach it will not fall from memory, as it fell earlier))))
#146217 personal license
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6995
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Open Everything GUI results with TC LOADLIST

Post by *Horst.Epp »

2AntonyD
I merged your changes into the original script, changing back all paths to my original.
It still works fine, with no big delays or errors.
I would never run this script with such large results as Tuska tried :)

The modified original is now
Spoiler

Code: Select all

; Transfer Everything GUI results to TC

; Authors: Horst.Epp & Ovg
; Last modified: 23.05.2025 Hosrt.Epp (Genral corrections)

; https://www.ghisler.ch/board/viewtopic.php?t=75439 ...... Open Everything GUI results with TC LOADLIST
; https://www.ghisler.ch/board/viewtopic.php?t=75417 ...... LOADLIST command and UTF8 file lists
; https://www.voidtools.com/forum/viewtopic.php?f=4&t=10594 Send ResultsList to Total Commander

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

#NoEnv
;#Persistent
#SingleInstance Force
SetBatchLines, -1

; Create / read .ini file settings
SetTitleMatchMode, RegEx
iniFile := RegExReplace(A_ScriptFullPath, "(ahk|exe)$", "ini")

if not (FileExist(iniFile)) {
    iniContent :="
    (( LTrim
        [General]
	; DestinationFile
        ;    Where to save the output (full path to DestinationFile.txt)
        ; EverythingColumnPositions (Default: 2,1)
	;    The columns 'Name' and 'Path' must be visible in the Everything GUI Window
        ;    The first value is the position of the 'Path' column
        ;    The second value is the position of the 'Name' column
	; CloseEverything (Default 1 for yes)
	;    Should Everything GUI window be closed after transfering to TC
	; UseInstance (Empty for default instance)
        ;    Name of the Everything instance to be used for closing the GUI

; The contents of the following lines must be adjusted if necessary, e.g. path and parameter adjustments.
;********************************************************************************************************
        DestinationFile = C:\Tools\Wincmd\Scripts\Results\Everything.txt
        EverythingColumnPositions=2,1
        AddEndSlash = 1
        CloseEverything = 1
        UseInstance =
        Everything = C:\Tools\Everything\Everything64.exe
        TotalCmd = C:\Tools\Wincmd\totalcmd64.exe
;********************************************************************************************************

    )"
    FileAppend, % iniContent, % iniFile, UTF-16
}
IniRead, DestinationFile, % iniFile, General, DestinationFile, %A_Space%
IniRead, EverythingColumnPositions, % iniFile, General, EverythingColumnPositions, 2`,1

IniRead, AddEndSlash, % iniFile, General, AddEndSlash, 1
IniWrite, %AddEndSlash%, % iniFile, General, AddEndSlash
IniRead, CloseEverything, % iniFile, General, CloseEverything, 1
IniWrite, %CloseEverything%, % iniFile, General, CloseEverything
IniRead, UseInstance, % iniFile, General, UseInstance, %A_Space%
IniWrite, %UseInstance%, % iniFile, General, UseInstance

IniRead, Everything, % iniFile, General, Everything, "C:\Tools\Everything\Everything64.exe"
IniRead, TotalCmd, % iniFile, General, TotalCmd, "C:\Tools\Wincmd\totalcmd64.exe"

DestinationFile           := ResolveEnvVars(DestinationFile)
EverythingColumnPositions := StrReplace(EverythingColumnPositions, " ")

; Force error if none is given (or path doesn't exist)
SplitPath, DestinationFile, , dstPath
if (DestinationFile = "" || !InStr(FileExist(dstPath), "D")) {
    Msgbox, 16, Fatal error, Destination file definition is missing or illegal named !
    Return
}
if (EverythingColumnPositions = "" || !InStr(EverythingColumnPositions, ","))
    EverythingColumnPositions := "2,1"

columnArray := StrSplit(EverythingColumnPositions, ",")

hWnd := WinExist("ahk_exe Everything(?:\d\d)*\.exe ahk_class EVERYTHING")

if hWnd
{
  ControlGet, winContent, List, , SysListView321, % "ahk_id" hWnd

  if (winContent)
  {
;   Loop over row(s)
    if (FileExist(DestinationFile))
      FileDelete, % DestinationFile
    FileAppend,, % DestinationFile, UTF-16

    Loop, Parse, winContent, `n
    {
      rowID := A_Index
      path  := ""
      name  := ""
      full  := ""
      Bad := 2
;     Loop over column(s)
      Loop, Parse, A_LoopField, % A_Tab
      {
        colID   := A_Index
        content := A_LoopField
        If (colID > columnArray[1] And colID > columnArray[2])
        {
          Break
        }
        Else
        {
          If (colID = columnArray[1])
          {
;            If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")
            If !RegExMatch(content,"i)^(?:[a-z]:|\\\.*?\\)")
            {
              Break
            }
            path := content
            Bad -= 1
            If !RegExMatch(path,"\\$")
            {
              path := path . "\"
            }
          }
          Else if (colID = columnArray[2])
          {
            If content is Space
            {
              Break
            }
            name := content
            Bad -= 1
          }
        }
      }
      If (Bad == 0)
      {
        full := path . name
        If InStr(FileExist(full),"D")
        {
          if (AddEndSlash == 1)
          {
            if !RegExMatch(full,"\\$")
            {
              full := full . "\"
            }
          }
          Else
          {
            If RegExMatch(full,"\\$")
            {
              full := SubStr(full,1,StrLen(full)-1)
            }
          }
        }
        FileAppend, % full "`n", % DestinationFile, UTF-16
      }
    }

	DestinationDir := SubStr(DestinationFile,1,InStr(DestinationFile,"\",,-1))
	Run %TotalCmd% /O /T /S LOADLIST:%DestinationFile%
	If (CloseEverything)
	  run %Everything% -instance "%UseInstance%" -close
;  Empty search result
  } Else {
	Msgbox, 16, , Search result is Empty, Nothing to do ...
  }
; No Everything window visible
} Else {
  Msgbox, 16, Fatal error, Everything window does not exist!
}
SetTitleMatchMode, 1
return

; ==================================
; = GOTO: FUNCTIONS - ResolveEnvVars
; ==================================
; http://www.autohotkey.com/board/topic/40115-func-envvars-replace-environment-variables-in-text/#entry310601
ResolveEnvVars(str)
{
	if sz := DllCall("ExpandEnvironmentStrings", "uint", &str, "uint", 0, "uint", 0)
	{
		VarSetCapacity(dst, A_IsUnicode ? sz * 2 : sz)
		if DllCall("ExpandEnvironmentStrings", "uint", &str, "str", dst, "uint", sz)
			return dst
	}
	return str
}

Windows 11 Home, Version 24H2 (OS Build 26100.4061)
TC 11.55 RC3 x64 / x86
Everything 1.5.0.1393a (x64), Everything Toolbar 1.5.3.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
User avatar
tuska
Power Member
Power Member
Posts: 4083
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

AntonyD wrote: 2025-05-23, 15:02 UTC I think using the AHK engine to transfer that such much memory data to the final file-list is a bit much a heavy-handed
approach to solving a problem.
Horst.Epp wrote: 2025-05-23, 15:31 UTC The modified original is now
; Last modified: 23.05.2025 Hosrt.Epp (Genral corrections)
> Horst, General <
Horst.Epp wrote: 2025-05-23, 15:31 UTC I would never run this script with such large results as Tuska tried :)
Me neither, unless it's for a TEST or to try out a NOTIFICATION MESSAGE
that only appeared when I transferred a large number of files.

My current working method is as follows and also includes the test results:
  1. I mainly perform search queries directly in Everything (pressing the 'Pause' key opens Everything 1.5 on my computer).
  2. I transfer files from EV to TC as follows, for example
    Everything Options - 1.5.0.1391a (x64)
    1. Double-click on the folder in Everything
      Context menu items: Open (Folders)
      Command: $exec("C:\totalcmd\TOTALCMD64.EXE" /O /A /S "%1")
    2. Double-click on the path in Everything
      Context menu items: Open Path, Explore Path
      Command: $exec("C:\totalcmd\TOTALCMD64.EXE" /O /A /S "%1")
  3. Small, manageable number of folders and files:
    Transfer from EV to TC using the AHK script
     
  4. Large number of folders and files
    To do this, I create the same search query in TC with the prefix ev: or ed:
    The reason for this is that there may be significant differences in the search results between EV and TC,
    which I do not want to check. (This problem has NOT occurred so far with the files that I normally need!).
    Examples (not exhaustive): Please see also my signature...
    1. Everything
      • Hidden/system files are automatically displayed in EV
        I don't want to have to prefix every search query with these commands: !attrib:s !attrib:h
        but if there is a different number of folders/files between EV and TC, after transferring to TC,
        that would be the first step for me.
      • Everything Options > Exclude
      • Index > Result Omissions, Temporary Result Omissions
    2. Total Commander
      Before executing the AHK script, the following points must be taken into account:
      • Hidden/system files should be displayed BEFORE executing the AHK script (cm_SwitchHidSys)
        OR the search query, these commands are prefixed: !attrib:s !attrib:h
      • Ignore list (cm_SwitchIgnoreList) must be checked (cm_IgnoreConfig) or disabled
        In the following test, the ignore list was disabled and hidden/system files were enabled in Total Commander...
    3. The transfer speed and search results are also important factors!
      • Transfer from Everything to Total Commander with the new AHK script:
        37% - 39% RAM consumption (mainly due to Properties and Content indexing).
        Approximately 660,000 files were displayed in the status bar of Everything.
        The transfer took 394 minutes/≈6.50 hours (other activities were carried out on the PC at the same time).
        Only 391,626 files were then displayed in Total Commander with the command cm_ExchangeSelBoth in the status bar.
        The button with the command: %COMMANDER_EXE% /O /T /S LOADLIST:%COMMANDER_PATH%\EV-Results\EV-Results.txt
        also lists 391,626 file(s) after executing cm_ExchangeSelBoth.
        The files were listed on the “Search Result:” tab.
        Name/Ext Size Date Attr. Path
        EV-Results.txt 103,718,840 May 23, 2025, 10:24 p.m. -a-- C:\totalcmd\EV-Results\
        EV-Results.txt (98.9 MB) contains 435,331 lines (EmEditor Professional (64-bit) Version 25.1.0, Notepad++ v8.8.1 (64-bit)).
         
      • Search in Total Commander (using Everything)
        - after a cold boot of the PC:
          ev: files: attributes:a
          [658557 files and 0 directories found] - Duration: 2 minutes
          Feed to listbox > cm_ExchangeSelBoth > 658557 file(s)
        - After cold start of the PC (test performed hours later!)
          ev: files: attributes:a
          TC: [656991 files and 0 directories found] - Duration: 2 minutes
          EV: 656 991 items (656 991 files, 0 folders)
         
      • During the transfer from EV to TC, the number of files (folders and files) may change,
        e.g. from 657451 files to 658524 files.
        In this case, it is NOT recommended to use the AHK script(!).

        In Everything, you can export the search results to a .TXT file:
        Ctrl+A Select all files > File > Export (Ctrl+S) > 2025-05-23_658562_Files_Attribute A.txt >
        File type: Text Files (*.txt) --- 74.9 MB --- 658562 lines
        and search for this file list in Total Commander > Search in: @c:\Path\File name.txt, Example...
        @C:\totalcmd\...\Memory limit reached\2025-05-23_658562_Files_Attribute A.txt
        Result:
        Search path not found! (126316x) *)
        [532246 files and 0 directories found]
        *) In this case, you could try starting Everything, Total Commander, and the AHK script
        with administrative rights instead of user rights.
    I can hereby confirm that the new AHK script could be used successfully WITHOUT the error message.

    However, the test results vary so widely for me, e.g. EV-Results.txt -> 98.9 MB (!) contains 435,331 lines in ≈6.50 hours,
    that I will NOT be using the new AHK script until further notice.

    Furthermore, the transfer takes much longer compared to the previous version, even with a smaller number of files.

    Transferring approximately 265,000 files from EV to TC, including executing the TC command: cm_ExchangeSelBoth
    — which displays the number of files in the TC status bar — takes approximately 2.5 minutes with the previous script.

    After 2 minutes, TC begins processing. After 2 minutes and 20 seconds, I press the cm_ExchangeSelBoth button.
    After 2 minutes and 30 seconds, the number of files is displayed in the status bar of Total Commander.

    265,000 files also seems to be the limit for the previous AHK script ...
    ... WITHOUT the message “Memory limit reached” appearing and processing then only being able to be canceled.

    I generally recommend checking the number of files/folders that were transferred from EV to TC using an AHK script,
    especially if there are a large number of them (information in the status bars possible).

    2AntonyD
    Thanks anyway for your efforts!

    Code: Select all

    ******************************************************************************************
    *  The simplest and fastest method for me at the moment is as follows:                   *
    *  									       		 *
    *  1. Search in Total Commander using Everything			       		 *
    *  2. Apply the search results by pressing Shift+click on the “Feed to listbox” button.  *
    *     The search result will then be listed in a separate tab.                 		 *
    * ****************************************************************************************

    Transfer 'Everything' GUI results to Total Commander:
    STEP-BY-STEP guide, PARAMETERS & Comments, TC commands, BUTTONS, ERROR MESSAGES and solutions, useful links,...
    Line 202 7. DIFFERENCES,...
Post Reply