CTRL F to on file to use it. CTRL m to show original Locate interface again.
Code: Select all
SetKeyDelay, -1
SetBatchLines -1
#IfWinActive, Locate ahk_class #32770
^m::
SetLocateWindow("show")
return
^f::
hwnd := WinExist("Locate:")
QV_TCGetControls()
SetLocateWindow()
QV_rect := QV_GetViewDestination()
QV_AdjustViewerPosition( QV_rect )
sFileName := ""
sPath := ""
ControlGet, sActiveRow, List, Selected, SysListView321
StringSplit, aRowElements, sActiveRow, %A_Tab%
sFileName := aRowElements1
sPath := aRowElements2
If (sFileName)
{
SetTCPath( sPath )
WinWaitActive, ahk_class TTOTAL_CMD
Loop
{
ControlGetText, ActivePath, TMyPanel2
StringTrimRight, ActivePath, ActivePath, 1
If (ActivePath = sPath)
Break
}
PostMessage, 1075, 2915
WinWaitActive, ahk_class TQUICKSEARCH
ControlSetText, TTabEdit1, %sFileName%
ControlSend, TTabEdit1, {Down}{Esc}
}
return
;------------------------------------------------------------------------
SetLocateWindow(state="")
{
global hwnd
if state=
state = Hide
if state = show
ControlMove, SysListView321, 0, 250,,, ahk_id %hwnd%
DllCall("SetMenu", "uint", hwnd, "uint", 0)
Control, %state%,, #327703 , ahk_id %hwnd%
Control, %state%,, Presets , ahk_id %hwnd%
Control, %state%,, Tab , ahk_id %hwnd%
Control, %state%,, Ne&w Search , ahk_id %hwnd%
Control, %state%,, Sto&p , ahk_id %hwnd%
Control, %state%,, F&ind Now , ahk_id %hwnd%
if state = hide
ControlMove, SysListView321, 0, 30,,, ahk_id %hwnd%
WinGetPos, x, y, w, h, ahk_id %hwnd%
WinMove, ahk_id %hwnd%, , x, y, w+1, h+1
WinSet, AlwaysOnTop, On, ahk_id %hwnd%
}
;------------------------------------------------------------------------
QV_TCGetControls()
{
global QV_TCActivePanel, QV_TCCurentDir, QV_TCHeader, QV_host
ControlGetText pLeft, TMyPanel5, ahk_class TTOTAL_CMD
ControlGetText pCurrent, TMyPanel2, ahk_class TTOTAL_CMD
StringReplace pCurrent, pCurrent, >
StringGetPos idx, pLeft, \, R
StringMid pLeft, pLeft, 1, idx
if StrLen(pLeft) = 2
pLeft = %pLeft%\
if (pLeft = pCurrent)
QV_TCActivePanel := "TMyListBox1"
else
QV_TCActivePanel := "TMyListBox2"
QV_TCCurentDir := "TMyPanel5"
QV_TCHeader := "THeaderClick1"
if QV_TCActivePanel = TMyListBox1
{
QV_TCCurentDir := "TMyPanel9"
QV_TCHeader := "THeaderClick2"
}
}
;---------------------------------------------------------------------------
QV_GetViewDestination()
{
global QV_mode, QV_Options_Width, QV_TCActivePanel, QV_TCCurentDir, QV_TCHeader, QV_host
rect =
ControlGetPos, , , , hh, %QV_TCHeader%, ahk_class TTOTAL_CMD
ControlGetPos cx, cy, cw, ch, %QV_TCCurentDir%, ahk_class TTOTAL_CMD
ControlGetPos, , , pw, ph, %QV_TCActivePanel%, ahk_class TTOTAL_CMD
WinGetPos x, y, , , ahk_class TTOTAL_CMD
vX := x + cx
vY := y + cy
vW := pw
vH := ph + ch + hh
rect = %vX%,%vY%,%vW%,%vH%
return rect
}
;---------------------------------------------------------------------------
QV_AdjustViewerPosition( rect )
{
global hwnd
loop, parse, rect, `,
{
p_%A_Index% := A_LoopField
}
WinMove, ahk_id %hwnd%, ,%p_1%,%p_2%,%p_3%,%p_4%
}
;------------------------------------------------------
SetTCPath(path)
{
if !WinExist("ahk_class TTOTAL_CMD")
{
Run, %COMMANDER_PATH%\TOTALCMD.EXE
WinWait ahk_class TTOTAL_CMD
}
WinActivate ahk_class TTOTAL_CMD
path := path "`r"
VarSetCapacity( CopyDataStruct, 12 )
InsertInteger( Asc( "C" ) + 256 * Asc( "D" ), CopyDataStruct )
InsertInteger( StrLen( path ) + 5, CopyDataStruct, 4 )
InsertInteger( &path, CopyDataStruct, 8 )
InsertInteger( Asc( "S" ), path, StrLen( path ) + 1, 1)
InsertInteger( Asc( "T" ), path, StrLen( path ) + 2, 1)
SendMessage, 0x4A, , &CopyDataStruct, , ahk_class TTOTAL_CMD
}
;------------------------------------------------------
SendTCCommand(cmd, wait=1)
{
if (wait)
SendMessage 1075, cmd, 0, , ahk_class TTOTAL_CMD
else
PostMessage 1075, cmd, 0, , ahk_class TTOTAL_CMD
}
;------------------------------------------------------
InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
{
mask := 0xFF
Loop %pSize%
{
DllCall("RtlFillMemory", UInt, &pDest + pOffset + A_Index - 1, UInt, 1, UChar, (pInteger & mask) >> 8 * (A_Index - 1))
mask := mask << 8
}
}