This took 100-150 ms and showed no command window. It is essentially the same as your script. Nonetheless, if you are looking for
text within files, Everything is not designed to do it. By this, I simply mean that the program would need to search within every file, and this process is not fast. Other programs (e.g., dtSearch) are available that
index all words
in all files and would provide faster output for this type of search.
Code: Select all
#Requires AutoHotkey v2.0
start := A_TickCount
es := A_ProgramFiles '\Everything\es.exe'
es := 'd:\Q\everything\es.exe'
folder := 'H:\Folders\Pics\'
folder := A_ScriptDir
arg := folder ' !.txt ' Random(1, 9)
out := A_Temp '\esOutput.txt'
Try FileRecycle out
RunWait es ' ' arg ' -export-txt ' out,, 'Hide'
; FileEncoding 'UTF-8'
If !esOutput := FileRead(out)
Return
line := StrSplit(esOutput, '`r`n')
randLine := Random(1, line.Length)
MsgBox line[randLine] '`n`nTime elapsed: ' A_TickCount - start ' ms'