Code: Select all
Everything_GetSelection(dir="0")
{
; Find the active window
WinGet, activeWindow, ID, A
if (!activeWindow) {
MsgBox, No active window found!
Return ""
}
; Check the window title
WinGetTitle, winTitle, ahk_id %activeWindow%
if (winTitle = "") {
MsgBox, Cannot retrieve window title!
Return ""
}
if !InStr(winTitle, "Everything 1") {
MsgBox, The active window is NOT Everything!`nFound: %winTitle%
Return ""
}
; First we try to take SysListView321 via ControlGetFocus
ControlGetFocus, fileListCtrl, ahk_id %activeWindow%
if (fileListCtrl != "SysListView321") {
fileListCtrl := "SysListView321" ; Forcibly trying this name
}
; Checking if the control exists
ControlGet, check, Visible,, %fileListCtrl%, ahk_id %activeWindow%
if (check = "0" or check = "") {
MsgBox, No file list control (SysListView321) found in Everything!
Return ""
}
; Get the selected files
ControlGet, selectedFiles, List, Selected, %fileListCtrl%, ahk_id %activeWindow%
if (selectedFiles = "") {
MsgBox, No files selected!
Return ""
}
Loop, parse, selectedFiles, `n, `r
{
filepath:=StrSplit(A_LoopField,A_Tab)
result .= filepath[2] "\" filepath[1] "`n"
}
; If dir
; Return % Trim(StrSplit(result,"`n").1,"`n") "\"
; else
Return % Trim(result,"`n")
}
Only after remaking the code for this, which is shown above - everything began to work for me.
Yes - I understand that code is very excessive there now - including an extra output through MSGBOX
But the main thing is that this concept works completely.
In the previous code, the code certainly did not work under any changes:
ControlGet, OutputVar, List, , SysListView321, ahk_exe %EverythingExe%
Perhaps there is/there was a limitation of the used V1 model of the script engine ...
Maybe it is still worth redrawing everything in V2? There is still further development there
And a fix of bugs. And the functionality of the same search is more advanced!
For example, this appeared: ControlGetClassnn - and now you can accurately verify when checking,
that control with the desired class exists in the window.
P.S.
Conversely, this "new"code lacks checking that the column sequence is correct.
Because if it is mixed by a user, the fact that in the code forcibly the second and
then the first columns are fetching and concat - it will not help to execute in overall
all code correctly. It's going to break.
P.P.S.
I found one strange piece of code:
Code: Select all
#If EscHotkeys and MatchList.settings.Everything and Everything_Active()
$Esc::
if (A_PriorHotkey <> "$Esc" or A_TimeSincePriorHotkey > 400)
{
Keywait Esc
Return
}
Else
{
WinClose ahk_exe everything.exe
WinClose ahk_exe everything64.exe
}
Return
#If
WHY we should forcibly to close the Everything process?
I wouldn't expect this behavior from a program that just got the ability to use a list of files
after filtering the search results in it -> to run them in corresponding editors...