The included AHK script requires at least TC 10.52 RC1.
With the help of user Highend from the XYplorer forum and user Ovg in this forum
we made an Autohotkey script and procedure which stores the results of the Everything GUI
into a text file and lets TC automatically load the results.
All pathnames below are from my environment and may be freely changed.
Download the AHK script from the Code section below.
and place it in a sub-dir of TC ( C:\Tools\Wincmd\Scripts\ExportEverythingWindow.ahk ).
Compile the script by right clicking the ahk file and select "Compile Script".
Assign a hotkey to the compiled script ( ExportEverythingWindow.exe ) or pin it to the taskbar.
Steps for automatic loading the Everything GUI results from a file with TCs LOADLIST:
1. Create a sub-dir inside of TC home for just this purpose ( C:\Tools\Wincmd\Scripts\Results )
The file Everything.txt results will be stored here.
2. Create an Auto Switch mode which triggers when the dir from step 1 is opened
and sets the View mode "Branch View"
3. Set the Branch view as follows:
- Sort order: Unchanged
- Auto-run commands: *|cm_SrcViewMode0
4. Run the script once and edit the created ini file to make any necessary option changes.
(No need to recompile the script for changing any options)
Parameters: (Set in the ini file ExportEverythingWindow.ini after first run of the script)
DestinationFile
- Where to save the output ( C:\Tools\Wincmd\Scripts\Results\Everything.txt )
EverythingColumnPositions (Default: 2,1)
- The columns 'Name' and 'Path' (must be visible in the Everything GUI)
- 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 the results to TC
UseInstance (empty to use default instance)
- Name of the Everything instance to be used for closing the GUI
Everything
- Full path to Everything (Default C:\Tools\Everything\Everything64.exe)
TotalCmd
- Full path to Total Commander (Default C:\Tools\Wincmd\totalcmd64.exe)
Usage:
Start Everything GUI and search your files.
Hit the hotkey or execute the compiled AHK script from the taskbar.
The script creates the Everything.txt result file
and executes Total Commander with the parameters /O /T /S LOADLIST:Path_to_Dir_from_Step1\Everything.txt
LOADLIST is started and the results are displayed as a TC Branch View without any further user action.
Below the Autohotkey file
Stored for me under C:\Tools\Wincmd\Scripts\ExportEverythingWindow.ahk
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:\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")
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
}