I know that there are several utilities similar to the one I am sharing here (Listary, EverythingToolbar...), but I created this one for my needs (I use this script mainly to try to avoid downloading stuff from the internet multiple times (duplicate files), checking if it already exists on the computer), and because it can be called faster than others, while interacting, in a more intuitive way e effective, than other utilities with Total Commander. I use the script from the FastKeys manager (a program made by and for autohotkey scripts), so it doesn't even have to be resident.
As usual. Adapt the routes of the "Everything" and Total Commander programs for each person (lines 27, 32, 34, 163, 180). So where is the temporary file created from (line 26). It makes use of the es.exe utility, which is from Everything and is used to make it work from the command line https://www.voidtools.com/es-es/descargas/.
In "Everythig" you can create images of removable drives (example: Everything64.exe -create-file-list "myfilelist.efu" "k:\Temporary\"; can be saved in a .bat file, for multiple use , —you have to configure the program to search these files—). The script searches those drives, but warns if the drive is not connected.
On line 89 (now commented out so that it has no effect) there is an example, in case you want to restrict the search to certain directories.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#InstallKeybdHook
FileEncoding, CP65001
;__________________________________________________________________________________________________________________________
#SingleInstance, Off
;SetTimer, GuiClose, 30000
;__________________________________________________________________________________________________________________________
^!F5::
GetKeyState, state, Ctrl
if (state = "D") ; Hold down the "Ctrl" key if you want to clear the clipboard and pop up the search window.
{
ClipBoard:=""
}
Send, ^c
OutFile = h:\File_Temp.txt ;Change the output file path if necessary. This file is not deleted until the next search.
App = d:\Utilidades\Everything\es.exe ;Change the path of the "Everything.exe" program if necessary.
;__________________________________________________________________________________________________________________________
DetectHiddenWindows, Off
if not WinExist("Everything64")
{
Run, d:\Utilidades\Everything\Everything64.exe -startup
}
;__________________________________________________________________________________________________________________________
If !Clipboard
{
Gosub, SearchGUI
}
Else
{
TempClip:= Clipboard
Gosub, Rutine
}
Return
;__________________________________________________________________________________________________________________________
SearchGUI:
TempClip:=Clipboard
xposSearch:= Floor((A_ScreenWidth/2)-450)
yposSearch:= Floor((A_ScreenHeight/2)-200)
Gui, Search:+HwndGuiID +AlwaysOnTop
Gui, Search: Font, S9 Bold, Verdana
Gui, Search: Add, Edit, x10 y16 w230 h20 vMySearch, Enter your Search
Gui, Search: Add, Button, x250 y16 w65 h20 GSearch, Search
Gui, Search: Add, CheckBox, x10 y46 w130 h20 vRegEx, RegEx Search
Gui, Search: Add, Button, x250 y46 w65 h20 gCancel, Cancel
Gui, Search: Show, x%xposSearch% y%yposSearch% h80 w330, Search
Return
#If WinActive("ahk_id " GuiID)
Enter::
NumPadEnter::
Search:
Gui Search: Submit
TempClip:=MySearch
Gui Search: Destroy
Gosub, Rutine
Return
;__________________________________________________________________________________________________________________________
Rutine:
ResvClip:=TempClip
FileDelete, %OutFile%
;FileDelete, h:\File_Temp_Full.txt
If RegEx=1
{
RunWait, "%App%" -export-txt "%OutFile%" -r "%TempClip%",, Hide
}
Else
{
TempClip:= RegexReplace(TempClip, "[\[\]()\-\_\s+]", "*") ;Subtract or Add symbols within this replacement line of the text to find. Now replace the symbols: -_[]() and space with a wildcard.
;RunWait, %comspec% /c chcp 65001 & "%App%" G:\mp3 ^| I:\Foundry ^| M:\Videos ^| F:\Document -export-txt "%OutFile%" "%TempClip%",, Hide ; ^| e:\Mp3\Recopilaciones\
;RunWait, %comspec% /c chcp 65001 & "%App%" -export-txt "%OutFile%" "%TempClip%",, Hide
RunWait, "%App%" -export-txt "%OutFile%" "%TempClip%",, Hide
}
;FileRead, OutputEnd , %OutFile% ; *P850
FileRead, OutputEnd, % *P850 OutFile
If !OutputEnd
{
Gosub, NotFound
}
Else
{
Gosub, ListCl
}
Return
;__________________________________________________________________________________________________________________________
NotFound:
MsgBox, 262144, %Clipboard%, The file does not exist on the computer. , 8
Return
;__________________________________________________________________________________________________________________________
Cancel:
Gui, Search: Destroy
Return
;__________________________________________________________________________________________________________________________
ListCl:
Gui, Control: Destroy
vOutput:=OutputEnd
Gui, Font, s12
Gui, Margin, 5, 5
Gui, -Caption +AlwaysOnTop
Gui, Add, Text, w290 h20 GuiMove, Search for: %ResvClip% ; - Search Results
Gui, Add, Button, x400 y5 w20 h20 gClose, X
Gui, Font, S10, Verdana Bold
Gui, Add, Button, x5 y516 w130 h20 gToList, Load List in TCM
Gui, Add, Button, x150 y516 w130 h20 gToBloc, Open in NotePad
Gui, Add, Button, x292 y516 w130 h20 gCopyClip, Copy to ClipBoard
Gui, Font, S14, Verdana Bold
Gui, Add, Listview, x5 y30 w416 r20 -hdr gMyLV, flnm|fllpth
for x,y in strsplit(vOutput,"`n", "`r")
{
splitpath,y,z
lv_Add("",z,y)
} until (x = 30) ; 30 Results
LV_ModifyCol(1,380)
LV_ModifyCol(2,0)
Gui, Show
Return
;__________________________________________________________________________________________________________________________
CopyClip:
Clipboard:= OutputEnd
Return
ToBloc:
Run, %OutFile%
Return
;__________________________________________________________________________________________________________________________
MyLv:
LV_GetText(fllpth, A_EventInfo, 2)
GetKeyState, state, Ctrl
if (state = "D")
{
SplitPath, fllpth, dir
Run, d:\TC UP\Totalcmd64.exe /T /O /L="%fllpth%",, Hide
}
Else
if not FileExist(fllpth)
{
SetTimer, WinMoveMsgBox, 50
MsgBox,4096, Notice, The file is on an unconnected drive!
}
Else
{
run, %fllpth%
}
;}
Return
ToList:
Run, d:\TC UP\Totalcmd64.exe /O /T /S LOADLIST:h:\File_Temp.txt,, Hide
Return
;__________________________________________________________________________________________________________________________
ButtonOK:
LV_GetText(fllpth, LV_GetNext(0, "Focused"),2)
if not FileExist(fllpth)
{
SetTimer, WinMoveMsgBox, 50
MsgBox,4096, Notice, The file is on an unconnected drive!
}
Else
{
run, Explorer %fllpth%
}
Return
;__________________________________________________________________________________________________________________________
;~Esc::
*Esc::
Close:
Gui, Destroy
Gui, Search: Destroy
Return
;__________________________________________________________________________________________________________________________
uiMove:
PostMessage, 0xA1, 2,,, A
Return
;__________________________________________________________________________________________________________________________
WinMoveMsgBox:
CoordMode, Mouse, Screen
xMsg:= Round((A_ScreenWidth/2)-150)
yMsg:= Round((A_ScreenHeight/2)-440)
SetTimer, WinMoveMsgBox, OFF
WinMove, Notice, , %xMsg%, %yMsg%
Return
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#InstallKeybdHook
FileEncoding, CP65001
;__________________________________________________________________________________________________________________________
#SingleInstance, Off
SetTimer, GuiClose, 30000
;run, taskkill /IM AutoHotkey.exe,, Hide
;__________________________________________________________________________________________________________________________
Multimedia=0
;^!F5:: ; If a keyboard shortcut is used, all lines with the "ExitApp" command must be replaced by the "Return" command, except the last line.
GetKeyState, state, Ctrl
if (state = "D") ; Hold down the "Ctrl" key if you want to clear the clipboard and pop up the search window.
{
ClipBoard:=""
}
;__________________________________________________________________________________________________________________________
;Send ^c ; You only need to select the search text.
GetKeyState, state, Alt
if (state = "D")
{
SendInput ^{left}+^{right}
Send, ^c
StringRight, Last, ClipBoard, 1
If Last=-
{
SendInput ^{left}+^{right}
Send, ^c
}
}
Else
{
Send ^c
}
OutFile = h:\File_Temp.txt ;Change the output file path if necessary. This file is not deleted until the next search.
OutMedia = h:\Temp_Media.txt
App = d:\Utilidades\Everything\es.exe ;Change the path of the "Everything.exe" program if necessary.
;__________________________________________________________________________________________________________________________
DetectHiddenWindows, Off
if not WinExist("Everything64")
{
Run, d:\Utilidades\Everything\Everything64.exe -startup
}
;__________________________________________________________________________________________________________________________
If !Clipboard
{
Gosub, SearchGUI
}
Else
{
TempClip:= Clipboard
Gosub, Rutine
}
Return
;__________________________________________________________________________________________________________________________
SearchGUI:
TempClip:=Clipboard
xposSearch:= Floor((A_ScreenWidth/2)-450)
yposSearch:= Floor((A_ScreenHeight/2)-200)
Gui, Search:+HwndGuiID +AlwaysOnTop
Gui, Search: Font, S9 Bold, Verdana
Gui, Search: Add, Edit, x10 y16 w230 h20 vMySearch, Enter your Search
Gui, Search: Add, Button, x250 y16 w65 h20 GSearch, Search
Gui, Search: Add, CheckBox, x10 y46 w130 h20 vRegEx, RegEx Search
Gui, Search: Add, Button, x250 y46 w65 h20 gCancel, Cancel
Gui, Search: Show, x%xposSearch% y%yposSearch% h80 w330, Search
Return
#If WinActive("ahk_id " GuiID)
Enter::
NumPadEnter::
Search:
Gui Search: Submit
TempClip:=MySearch
Gui Search: Destroy
Gosub, Rutine
Return
;__________________________________________________________________________________________________________________________
Rutine:
ResvClip:=TempClip
FileDelete, %OutFile%
FileDelete, h:\File_Temp_Full.txt
If RegEx=1
{
RunWait, "%App%" -export-txt "%OutFile%" -r "%TempClip%",, Hide
}
Else
{
TempClip:= RegexReplace(TempClip, "[\[\]()\-\_\s+]", "*") ;Subtract or Add symbols within this replacement line of the text to find. Now replace the symbols: -_[]() and space with a wildcard.
;RunWait, %comspec% /c chcp 65001 & "%App%" G:\Download ^| I:\Tutoriales\Foundry ^| M:\Temporal ^| h:\Temporal ^| F:\Temporal\ -export-txt "%OutFile%" "%TempClip%",, Hide
RunWait, %comspec% /c chcp 65001 & "%App%" G:\mp3 ^| I:\Foundry ^| M:\Videos ^| F:\Document -export-txt "%OutFile%" "%TempClip%",, Hide
;RunWait, "%App%" -export-txt "%OutFile%" "%TempClip%",, Hide
}
FileDelete, %OutMedia%
FileRead, OutputEnd, %OutFile%
If !OutputEnd
{
Gosub, NotFound
}
Else
{
Gosub, ListCl
}
Return
;__________________________________________________________________________________________________________________________
NotFound:
MsgBox, 262144, %Clipboard%, The file does not exist on the computer. , 8
;MsgBox, %Clipboard%, The file does not exist on the computer.
ExitApp
;__________________________________________________________________________________________________________________________
Cancel:
ExitApp
;__________________________________________________________________________________________________________________________
ListCl:
Gui, Control: Destroy
vOutput:=OutputEnd
Gui, Font, s12
Gui, Margin, 5, 5
Gui, -Caption +AlwaysOnTop
Gui, Add, Text, w290 h20 GuiMove, %ResvClip% ; - Search Results
Gui, Add, Button, x400 y5 w20 h20 gClose, X
Gui, Font, S10, Verdana Bold
Gui, Add, Button, x5 y516 w130 h20 gToList, Load List in TCM
Gui, Add, Button, x150 y516 w130 h20 gToBloc, Open in NotePad
Gui, Add, Button, x292 y516 w130 h20 gCopyClip, Copy to ClipBoard
Gui, Font, S14, Verdana Bold
Gui, Add, Listview, x5 y30 w416 r20 -hdr gMyLV, flnm|fllpth
for x,y in strsplit(vOutput,"`n", "`r")
{
splitpath,y,z
lv_Add("",z,y)
} until (x = 30) ; 30 Results
LV_ModifyCol(1,380)
LV_ModifyCol(2,0)
Gui, Show
Return
;__________________________________________________________________________________________________________________________
CopyClip:
Clipboard:= OutputEnd
Return
ToBloc:
Run, %OutFile%
Return
ToList:
Run, d:\TC UP\Totalcmd64.exe /O /T /S LOADLIST:h:\File_Temp.txt,, Hide
Return
;__________________________________________________________________________________________________________________________
MyLv:
LV_GetText(fllpth, A_EventInfo, 2)
;run, Explorer %fllpth%
GetKeyState, state, Ctrl
if (state = "D")
{
SplitPath, fllpth, dir
;MsgBox, %fllpth%
Run, d:\TC UP\Totalcmd64.exe /T /O /L="%fllpth%",, Hide
;Run d:\TC UP\Totalcmd64.exe /O /T /S LOADLIST:h:\File_Temp.txt,, Hide
}
Else
{
If InStr(FileExist(fllpth),"D")
{
;Run d:\TC UP\Totalcmd64.exe /O /T /S LOADLIST:h:\File_Temp.txt,, Hide
Run, d:\TC UP\Totalcmd64.exe /T /O /L="%fllpth%",, Hide
;d:\TC UP\Totalcmd64.exe /O /T /S LOADLIST: h:\Download\Find_Files.txt
}
Else
*/
if not FileExist(fllpth)
{
SetTimer, WinMoveMsgBox, 50
MsgBox,4096, Notice, The file is on an unconnected drive!
}
Else
{
run, %fllpth%
}
}
Return
;__________________________________________________________________________________________________________________________
ButtonOK:
LV_GetText(fllpth, LV_GetNext(0, "Focused"),2)
/*
GetKeyState, state, Ctrl
if (state = "D")
{
Run, d:\TC UP\Totalcmd64.exe /T /O /L="%fllpth%",, Hide
}
Else
{
*/
if not FileExist(fllpth)
{
SetTimer, WinMoveMsgBox, 50
MsgBox,4096, Notice, The file is on an unconnected drive! ; 8 ; 262144
;MsgBox, The file is on an unconnected drive!
}
Else
{
run, Explorer %fllpth%
}
;}
Return
;__________________________________________________________________________________________________________________________
;~Esc::
*Esc::
Close:
Gui, Destroy
Gui, Search: Destroy
;Send, !{f4}
ExitApp
GuiClose:
ExitApp
;__________________________________________________________________________________________________________________________
uiMove:
PostMessage, 0xA1, 2,,, A
Return
WinMoveMsgBox:
CoordMode, Mouse, Screen
xMsg:= Round((A_ScreenWidth/2)-150)
yMsg:= Round((A_ScreenHeight/2)-440)
SetTimer, WinMoveMsgBox, OFF
WinMove, Notice, , %xMsg%, %yMsg%
Return
(With a little effort and ingenuity, the list could have a column of icons for the type of file it is, but it's known by the extension, and it doesn't, it's possible it's a directory.)