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: white, Hacker, petermad, Stefan2

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

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

Horst.Epp wrote: 2021-10-19, 15:18 UTC Also line 52 and 53 are correct, the last parameters here are used if no definition is made above.
OK, thanks for the explanation.

According to your explanation, the only thing left to hope for in lines 52 and 53 is that a user uses these paths,
if he has NOT made an entry in lines 41 and 42. But maybe I don't understand your explanation.
User avatar
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

The following options are currently available.

Code: Select all

------------------------------------------------------------------------------------------------------------------------
|     | Everything | EV: 1 Instance | EV-window | EV-window | 				                   |  Hotkeys  |
| No. | "Main"     | e.g.  PRIVATE  |    OPEN   |    CLOSED | Parameters				   |   (QAP)   |
|=====|============|================|===========|===========|==============================================|===========|
|  1  |     X      |       -        |    -      |    X      | CloseEverything = 1        (default) *)      |           |
|     |            |                |           |           | run %Everything% -close                      |           |
|-----|------------|----------------|-----------|-----------|----------------------------------------------|-----------|
|  2  |     X      |       -        |    X      |    -      | CloseEverything = 0                          |           |
|     |            |                |           |           | run %Everything% -close                      |           |
|=====|============|================|===========|===========|==============================================|===========|
|  3  |     -      |       X        |    -      |    X      | CloseEverything = 1        (default) *)      |           |
|     |            |       	    |	 	|    	    | run %everything% -instance "PRIVATE" -close  |           |
|-----|------------|----------------|-----------|-----------|----------------------------------------------|-----------|
|  4  |     -      |       X        |    X      |    -      | CloseEverything = 0                          |           |
|     |            |       	    |	 	|    	    | run %everything% -instance "PRIVATE" -close  |           |
|=====|============|================|===========|===========|==============================================|===========|

------------------------------------------------------------------------------------------------------------------------
|     | Everything | EV: 1 Instance | EV-window | EV-window | 				                   |  Hotkeys  |
| No. | "Main"     | e.g.  PRIVATE  |    OPEN   |    CLOSED | Parameters				   |   (QAP)   |
|*****|************|****************|***********|***********|**********************************************|***********|
|  5  |     X      |       -        |    X      |           | ;CloseEverything = 0                         | AltGr + S |
|     |            |                |           |    X      | run %Everything% -instance "PRIVATE" -close  | AltGr + D |
|-----|------------|----------------|-----------|-----------|----------------------------------------------|-----------|
|  6  |     -      |       X        |    X      |           | ;CloseEverything = 0                         | AltGr + D |
|     |            |                |           |    X      | run %Everything% -close                      | AltGr + S |
|*****|************|****************|***********|***********|**********************************************|***********|

When using Everything (No. 5) AND an Everything - (PRIVATE) instance (No. 6), I have the option,
to leave the Everything window OPEN -OR- CLOSED when transferring a search result to TC!
The use of a button or a system-wide hotkey (QAP) is possible.
*) (default): https://ghisler.ch/board/viewtopic.php?p=406422#p406422 ...
Horst.Epp wrote: 2021-10-19, 08:05 UTC Updated the first post.
I have added an option to close the Everything window or not.
Default is set to close.
I suggest adding the following parameters to the .INI file as well:

Code: Select all

run %Everything% -close
run %Everything% -instance "INSTANCENAME" -close
... because if someone wants to use Everything instances, corresponding changes must be made in the AHK script.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Open Everything GUI results with TC LOADLIST

Post by *Horst.Epp »

tuska wrote: 2021-10-19, 23:10 UTC I suggest adding the following parameters to the .INI file as well:

Code: Select all

run %Everything% -close
run %Everything% -instance "INSTANCENAME" -close
... because if someone wants to use Everything instances, corresponding changes must be made in the AHK script.
I will not add a 2nd Everything close command
but an option to define an instance name, default set to blank.
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
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

2Horst.Epp
Ahh, I expressed myself wrongly.

I meant:

Code: Select all

run %Everything% -close
- OR -
run %Everything% -instance "INSTANCENAME" -close
At the moment I see for a user with this script or further scripts (for EV-instances)
to consider the following lines:

Code: Select all

Lines  37-42
Lines  52-53
Line   154
To increase user-friendliness, I propose the following:
2021-10-19_1009_HorstEpp_FirstPost_User-friendly.ahk

Code: Select all

Line 37: DestinationFile = C:\Tools\Wincmd\Scripts\Results\Everything.txt
Line 38: EverythingColumnPositions=2,1
Line 39: AddEndSlash = 1
Line 40: CloseEverything = 1
Line 41: Everything = C:\Tools\Everything\Everything64.exe
Line 42: TotalCmd = C:\Tools\Wincmd\totalcmd64.exe
Line 43: Everything = C:\Tools\Everything\Everything64.exe
;This refers to line 52: IniRead, Everything, % iniFile, General, Everything, "C:\Tools\Everything\Everything64.exe"
Line 44: Everything = C:\Tools\Everything\Everything64.exe
;This refers to line 53: IniRead, TotalCmd, % iniFile, General, TotalCmd, "C:\Tools\Wincmd\totalcmd64.exe"
Line 45: Instance-name = Everything  -> default
         - OR - 
         Instance-name = PRIVATE     -> if another instance is used, e.g. "Everything - (PRIVATE)"
;This refers to line 154: run %Everything% -close - OR - Line 154: run %Everything% -instance "PRIVATE" -close
The user would then have to make his entries/changes in lines 37 - 45 (9 lines contiguous).
If I have understood you correctly, I think that lines 43 and 44 could be omitted because they are duplicated.

There would then only be 7 lines (contiguous!) left for the user to check/fill in.

This could then look like this:
2021-10-19_1009_HorstEpp_FirstPost.ini

Code: Select all

[General]
; DestinationFile
; Where to save the output (full path to DestinationFile.txt)
; EverythingColumnPositions
; 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 (Default: 2,1)
; Should Everything GUI window be closed after transfering to TC

; 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
Everything = C:\Tools\Everything\Everything64.exe
Instance = run %Everything% -close
TotalCmd = C:\Tools\Wincmd\totalcmd64.exe
;********************************************************************************************************
2021-10-19_1009_HorstEpp_FirstPost_Instance (PRIVATE).ini

Code: Select all

[General]
; DestinationFile
; Where to save the output (full path to DestinationFile.txt)
; EverythingColumnPositions
; 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 (Default: 2,1)
; Should Everything GUI window be closed after transfering to TC

; 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
Everything = C:\Tools\Everything\Everything64.exe
Instance = run %everything% -instance "PRIVATE" -close
TotalCmd = C:\Tools\Wincmd\totalcmd64.exe
;********************************************************************************************************
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Open Everything GUI results with TC LOADLIST

Post by *Horst.Epp »

I have added the new option UseInstance
to specify the instance to be closed (if the close option ist set).
See the code in the first post.
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: Open Everything GUI results with TC LOADLIST

Post by *Horst.Epp »

tuska wrote: 2021-10-20, 09:35 UTC 2Horst.Epp
Ahh, I expressed myself wrongly.
Thats a rather confusing post :wink:
Posting code changes which are not necessary are not helpfull.

Users should read the updated first post.
All necessary settings are there and described in short.
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: Open Everything GUI results with TC LOADLIST

Post by *Horst.Epp »

I have added code to add some missing options with their default values in the generated ini file.
This allows to update to a newer script version without loosing the customized ini file entries.
Previously you had to delete the ini file to get a new one
or to enter the new options by hand.
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
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

Horst.Epp wrote: 2021-10-20, 12:59 UTC
tuska wrote: 2021-10-20, 09:35 UTC 2Horst.Epp
Ahh, I expressed myself wrongly.
Thats a rather confusing post :wink:
Posting code changes which are not necessary are not helpfull.
Well, that's how you take it. :wink:

It was only a suggestion (from someone who has no knowledge of any programming language),
but I guess at least it led you to consider, for the first time in the script,
that a user could also use Everything instances in addition to Everything.

Thus, based on my suggestion, there is now the advantage,
  1. that a user no longer has to search through the entire code to get to the settings to be changed
  2. that the user can now enter the settings in line 45 instead of line 154.
    This is now where the other user inputs are located
  3. a user no longer has to change this programme code himself -> run %Everything% -close
    A change was necessary here, e.g. when using additional Everything instances.
  4. No second script is required for an additional instance, e.g. 'Everything - PRIVATE'
The only thing that irritates me in the script is that the paths in the following lines are identical:
46 <=> 63 ... and ... 47 <=> 64 -> once with and once without inverted commas "". See also below ...
I would like to see only one path here at a time.

Here are the test results for "Test1":
Test1: 2021-10-20_1810_(26x)_HorstEpp_FirstPost_tuska.AHK - only parameters

Code: Select all

;********************************************************************************************************
        DestinationFile = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\EV-Results\EV-Results.txt
        EverythingColumnPositions=2,1
        AddEndSlash = 1
        CloseEverything = 0
        UseInstance = Everything
        Everything = "C:\Tools\Everything\Everything64.exe"
        TotalCmd = "D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\TOTALCMD64.EXE"
IniRead, Everything, % iniFile, General, Everything, "C:\Tools\Everything\Everything64.exe"
IniRead, TotalCmd, % iniFile, General, TotalCmd, "D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\TOTALCMD64.EXE"
             run %Everything% -instance "%UseInstance%" -close
;********************************************************************************************************
Test1: 2021-10-20_1810_(26x)_HorstEpp_FirstPost_tuska.INI - Everything 1.5.0.1280a (x64) "MAIN Instance"

Code: Select all

;********************************************************************************************************
DestinationFile = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\EV-Results\EV-Results.txt
EverythingColumnPositions=2,1
AddEndSlash =1
CloseEverything =0
UseInstance =Everything
Everything = C:\Tools\Everything\Everything64.exe
TotalCmd = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\TOTALCMD64.EXE
;********************************************************************************************************
Test1: 2021-10-20_1810_(26x)_HorstEpp_FirstPost_tuska.INI - Everything 1.5.0.1280a (x64) - (PRIVATE)

Code: Select all

;********************************************************************************************************
DestinationFile = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\EV-Results\EV-Results.txt
EverythingColumnPositions=2,1
AddEndSlash =1
CloseEverything =0
UseInstance =Everything
Everything = C:\Tools\Everything\Everything64.exe
TotalCmd = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\TOTALCMD64.EXE
;********************************************************************************************************
Test1: 2021-10-20_1810_(26x)_HorstEpp_FirstPost_tuska.ahk -> RESULTS!
  • For user inputs (entries/changes), I currently consider the lines with nos. 41-47 and 63-64 as relevant.
     
  • Note - on .INI file:
    Provided 2 Everything instances (Everything + 'Everything - (PRIVATE)' were started,
    it is currently not possible to determine which instance was used to transfer the search result.

    If you have opened the .INI file in EmEditor, for example, you will you get the following message
    when switching between the Everything instances:
    "File changed by another program. Reload with changes?
    D:\Data\Programs\TotalCommander\TCD_USB-Stick\TC32-64USB\Migration\_Forumsanfragen\...
    Open Everything GUI results with TC LOADLIST\2021-10-20_Scripts\2021-10-20_1810_(26x)_HorstEpp_FirstPost_tuska.ini
    "

    A click on the button "Reload" in EmEditor results in the .INI files of the
    Everything instance and 'Everything - (PRIVATE)' instance are IDENT.
  • Code: Select all

    [General]
    ; UseInstace (empty for default instance)
    ; UseInstance (empty for default instance)  <- Proposal
  • On this occasion:

    Code: Select all

    Usage: Optionaly set the UseInstance and CloseEverything options
    Usage: Optionally, the options UseInstance and CloseEverything can be set ... <-- Proposal
  • Paths with spaces - Note:

    Code: Select all

    In line no. 41, 45, 46, 47 the field content must NOT be enclosed in inverted commas! *
    In line no. 63, 64 ....... the field content (paths) may be enclosed in inverted commas.
    * What happens if someone has spaces in the path? Can the script handle that? Should the user be given a hint?
    I will not test this additionally, but it would be good to know....
  1. Code: Select all

    Everything OPENED + Everything - (PRIVATE) started | Search query in Everything: D:\Daten\WINWORD\ --> Result: OK
  2. Code: Select all

    Everything started + Everything - (PRIVATE) OPENED | Search query in Everything - (PRIVATE): ..... --> Result: OK
  3. Code: Select all

    Everything <only> ......................... OPENED | Search query in Everything: D:\Daten\WINWORD\ --> Result: OK
  4. Code: Select all

    Everything - (PRIVATE) <only> ............. OPENED | Search query in Everything - (PRIVATE): ..... --> Result: OK
I.e. the "first" test with script version "2021-10-20_1810_(26x)_HorstEpp_FirstPost.ahk" was SUCCESSFUL!

THANK YOU for your efforts!


PS:
At that time there was a "problem" which was solved by a request: Differences (clarified)
Everything -> Search for -> N:\ (Backslash!):
Then the drive letter itself is no longer displayed in the search result in Everything (and is NOT counted)!
User avatar
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

Here are two more test results.

Test: SUCCESSFUL!
Sharing folder Y ... AND ... 'Connect network drive' performed!
  • D:\zTEST\Y\ corresponds to \\Tuska-pc\Y\
  • Y -> Sharing of folder Y ... AND ... Connect network drive performed!
  • After clicking on the drive letter Y\ in Total Commander, the following path is displayed: \Tuska-pc\Y\
  • The tooltip for the button shows \\Tuska-pc\Y (without backslash). File properties shows: Y (\\Tuska-pc)
  • In Windows Explorer, the following is displayed under "This PC" under network addresses: y (\\Tuska-pc) (Y:)
  • Everything: Indexes - Network Drives -> y (\\Tuska-pc) (Y:)
  • Search query in Everything: Y:\ (backslash required, otherwise drive Y itself is added to the total!)
  • Result: 2 folders, 2 files
  • Transfer of the search result with "2021-10-20_1810_(26x)_HorstEpp_FirstPost_tuska.exe".
  • Result: 2 files, 2 folders are displayed on tab "Search result:" in Total Commander -> OK
  • Search query in Total Commander:
    1. cm_SwitchHidSys -> show hidden files ... first!
    2. Search in: \\Tuska-pc\Y\
  • Result: [2 files and 2 directories found] -> OK

 
Test: NOT successful!
Mount network folders as drives
  • tsclient= ... Mount network folders as drives
  • D:\zTEST\X\ corresponds to \\Tuska-pc\X\
  • X\ ... Share folder X only
  • After clicking on the drive letter X\ in Total Commander, the following path is displayed in TC: \\Tuska-pc\X\
    The tooltip for the button shows \\Tuska-pc\X. File properties shows: X (\\Tuska-pc).
    In Windows Explorer the shared folder X is NOT displayed, e.g. under network addresses(!)
  • Everything: Indexes - Folders -> \\Tuska-pc\X\
  • Search query in Everything: \\Tuska-pc\X\
  • Result: 2 folders, 4 files (1 file of them hidden -> descript.ion)
  • Transfer of search result with "2021-10-20_1810_(26x)_HorstEpp_FirstPost_tuska.exe"
  • Result:
    1. EV-Results.txt ................................. -> EMPTY!
    2. Search result in TC on tab "Search result:" -> EMPTY!
  • Search query in Total Commander:
    1. cm_SwitchHidSys -> show hidden files ... first!
    2. Search in: \\Tuska-pc\X\
  • Result: [4 files and 2 directories found] -> OK
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *Ovg »

tuska wrote: 2021-10-21, 00:58 UTC Test: NOT successful!
Mount network folders as drives
  • tsclient= ... Mount network folders as drives
  • D:\zTEST\X\ corresponds to \\Tuska-pc\X\
  • X\ ... Share folder X only
  • After clicking on the drive letter X\ in Total Commander, the following path is displayed in TC: \\Tuska-pc\X\
    The tooltip for the button shows \\Tuska-pc\X. File properties shows: X (\\Tuska-pc).
    In Windows Explorer the shared folder X is NOT displayed, e.g. under network addresses(!)
  • Everything: Indexes - Folders -> \\Tuska-pc\X\
  • Search query in Everything: \\Tuska-pc\X\
  • Result: 2 folders, 4 files (1 file of them hidden -> descript.ion)
  • Transfer of search result with "2021-10-20_1810_(26x)_HorstEpp_FirstPost_tuska.exe"
  • Result:
    1. EV-Results.txt ................................. -> EMPTY!
    2. Search result in TC on tab "Search result:" -> EMPTY!
Indeed, currently not supported...
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *Ovg »

2tuska
Change line 111 in script from the 1st post to

Code: Select all

If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")
and try again
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Open Everything GUI results with TC LOADLIST

Post by *Horst.Epp »

tuska wrote: 2021-10-20, 20:12 UTC
2tuska
Thanks for testing.
I have corrected some typing errors.
The script handles spaces in path names in my tests.
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: Open Everything GUI results with TC LOADLIST

Post by *Horst.Epp »

Ovg wrote: 2021-10-21, 05:13 UTC 2tuska
Change line 111 in script from the 1st post to

Code: Select all

If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")
and try again
I have changed the script in first post.
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
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *Ovg »

2Horst.Epp

Sorry, minor update

Please change line 111 to

Code: Select all

If !RegExMatch(content,"i)^(?:[a-z]:|\\\.*?\\)")
For Users: comments shouldn't starts with "\\" :wink:
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Open Everything GUI results with TC LOADLIST

Post by *tuska »

Ovg wrote: 2021-10-21, 05:13 UTC 2tuska
Change line 111 in script from the 1st post to

Code: Select all

If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")
and try again
That works great. :D
Thanks!

Tests carried out with 3 instances: MAIN, PRIVATE, PRIVAT.
- For user inputs (entries/changes), I currently consider the lines with nos. 41-47, 63, 64, 163 as relevant.
- For this test, I consider the lines with nos. 3, 41-47, 63, 64, 111, 163, 165 as relevant.

Code: Select all

Line   3: ; Last modified: 20.10.2021 (Added option UseInstance) .... 21.10.2021: If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")
Line  41:         DestinationFile = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\EV-Results\EV-Results.txt
Line  42:         EverythingColumnPositions=2,1
Line  43:         AddEndSlash = 1
Line  44:         CloseEverything = 0
Line  45:         UseInstance = Everything
Line  46:         Everything = C:\Tools\Everything\Everything64.exe
Line  47:         TotalCmd = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\TOTALCMD64.EXE
Line  63: IniRead, Everything, % iniFile, General, Everything, "C:\Tools\Everything\Everything64.exe"
Line  64: IniRead, TotalCmd, % iniFile, General, TotalCmd, "D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\TOTALCMD64.EXE"
Line 111:             If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")
Line 163: 	Run %TotalCmd% /O /T /S %DestinationDir%
Line 165:              run %Everything% -instance "%UseInstance%" -close
2021-10-21_0954_(29x)_HorstEpp&Ovg_FirstPost_tuska.ahk

Code: Select all

; Transfer Everything GUI results to TC
; Authors: Horst.Epp & Ovg
; Last modified: 20.10.2021 (Added option UseInstance) .... 21.10.2021: If !RegExMatch(content,"i)^[a-z]:|\\\.*?\\")

; 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)
        ;    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 results 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 = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\EV-Results\EV-Results.txt
        EverythingColumnPositions=2,1
        AddEndSlash = 1
        CloseEverything = 0
        UseInstance = Everything
        Everything = C:\Tools\Everything\Everything64.exe
        TotalCmd = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\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, "D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\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]:|\\\.*?\\")
            {
              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 %DestinationDir%
	If (CloseEverything == 1) {
             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
}
2021-10-21_0954_(29x)_HorstEpp&Ovg_FirstPost_tuska.ini
; An entry in line 45: UseInstance =
; is not necessary, because you can use e.g. 3 Everything instances without problems "at the same time"s.

Code: Select all

[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)
;    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 results 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 = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\EV-Results\EV-Results.txt
EverythingColumnPositions=2,1
AddEndSlash =1
CloseEverything =0
UseInstance =Everything
Everything = C:\Tools\Everything\Everything64.exe
TotalCmd = D:\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\TOTALCMD64.EXE
;********************************************************************************************************
On the "Search result:" tab, for example, the following is then displayed:

Code: Select all

\\Tuska-pc\X\Test\
\\Tuska-pc\X\Test1\
\\Tuska-pc\X\descript.ion
\\Tuska-pc\X\File1.JPG
\\Tuska-pc\X\File.doc
\\Tuska-pc\X\File3.jpg
Now I'll do another quick test with this parameter:

Code: Select all

If !RegExMatch(content,"i)^(?:[a-z]:|\\\.*?\\)")


Horst.Epp wrote: 2021-10-21, 07:59 UTC
tuska wrote: 2021-10-20, 20:12 UTC
2tuska
I have corrected some typing errors.
The script handles spaces in path names in my tests.
Thank you - also for the information! :D



Remark:
What do you think about using CloseEverything = 0 as default setting?

Especially users who use the script for the first time would have the advantage
- with regard to comparing the search result in EV and TC -
that they do not have to perform the search query again in EV.

On the other hand, if there is no error message, and the search result is not empty,
then the transfer should have been carried out properly.
Post Reply