How to speed up the "Search Everything" main functionality
The "Search Everything" (http://www.voidtools.com/) is a fantastic free software, but it lacks a very basic thing, which is to "Search within the current path". Currently, if you wanted to search for the files inside the currently opened folder in windows explorer, say... "C:\Temp", you would have to manualy go up to "C:\", then select the Temp folder, right click on it, chose the "Search Everything" option and only after doing all that you would get what you needed.
Is there anything that could make this repeatitive procedure less painfull?
Solution 1:
I thought there must be a better way to do this. I discovered a creator of this tool make an effort to support Command Line Options, and so I made a nice little AutoHotkey script which shortens all that procedure described into first paragraph to one keyboard shortcut.
Very important note is that the script is tested only on Windows7 x64, so I can't guarantee it will work on Windows8, WindowsXP etc.
The script obviously needs AutoHotkey to be installed on the machine, and the script has to be run on every Windows bootup (so the easiest way would be to copy the link to the script, or copy the whole script into Autostart folder) so that it can capture the keyboard shortcut. The shortcut is set for Win+F, but it can be easily modified within the script. One thing to keep in mind, the script depends on the path to the Everything.exe file to be under this path: "C:\Program Files\Everything\Everything.exe"
If it's somewhere else, modify that line.
When writing this script, I used as a backbone, this script: https://superuser.com/a/205368/172360
which was the only one I could find in all the web, that worked on my machine, and returned the path. I tweaked it a bit because it used the literal word "Address" unnecesearily and it was dependant on the local language used in the client OS which brought a big limitation and so I replaced it with regular expression to work on any locale (in theory ;)). Also the path had to be formated in the right way so I changed that. After that I added the relevant code for the SearchEverywhere app, added some comments too.
To "install" the script, you have to save it to a text file with the .ahk extension, and run it so that it can reside in background.
So as for the user experience, once you are all set, all you got to do, is press the shortcut (Win+F) with the Windows Explorer focused and the Search Everything app will be started with the relevant path entered automaticaly in the search box. Keep in mind the default Win+F will happen (this is very much expected and desired behaviour), if the currently focused window in windows is not explorer. If the current page of the explorer is opened on the "My computer" page this call will be ignored completely.
It works great, and I hope it will be beneficial to someone else, besides me. Enjoy.
;////////////////////////////////////////////////////
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;****************************************************
;********* *************
;********* Written by: *************
;********* soyo/Luk *************
;********* *************
;********* Search everything: ver1_0_0 *************
;********* *************
;****************************************************
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;////////////////////////////////////////////////////
SetTitleMatchMode RegEx
return
; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass
; When user presses Win+F in an explorer window, we Search Everything within this path
; If Other shortcut is required, it can be changed here
;
#f::
SearchEverythingInPath()
return
#IfWinActive
; Invokes Search Everything app with the current path as the path argument
; Note: expecting to be run when the active window is Explorer.
;
SearchEverythingInPath()
{
; This is required to get the full path of the file from the address bar
WinGetText, full_path, A
; Split on newline (`n)
StringSplit, word_array, full_path, `n
; Find and take the element from the array that contains address
Loop, %word_array0%
{
FoundPrefixOccurance := RegExMatch(word_array%A_Index%, ".*:\\*")
if(FoundPrefixOccurance > 0)
{
full_path := word_array%A_Index%
break
}
}
; strip to bare address
full_path := RegExReplace(full_path, "^" ".*: ", "")
; Just in case - remove all carriage returns (`r)
StringReplace, full_path, full_path, `r, , all
IfInString full_path, \
{
; We remove the last backslash if there is any in the stipped path, this happens when the path is a root of a partition so
; for example "C:\"
full_path := RegExReplace(full_path, "\\$" "" )
; After we are sure we have a stripped path without the backslash at the end, now we can safely add a backslash
full_path = %full_path%\
; We run Search Everything with the path atribute
Run, "C:\Program Files\Everything\Everything.exe" -p "%full_path%"
}
else
{
}
}