
To test it open the TC and execute the script. Press ALT M to open input box. Type a file name in any panel to select it.
Code: Select all
!m::
InputBox fn, ,type a file name to select
if errorlevel != 1
if !SetTCFileName(fn, "right", 1)
SetTCFileName(fn, "left", 1)
return
;--------------------------------------------------------------------
; PURPOSE: Set the focus to given file name
;
; ARGS:
; FN - file name to set
; panel - panel in witch file resides (1=right=default, 2=left)
; select - true to select, false=default
;
SetTCFileName( fn, panel="", select=false )
{
static sss, LB_SETCARETINDEX, LB_GETTEXT
;initialise
if LB_SETCARETINDEX=
{
LB_SETCARETINDEX = 0x19E
LB_GETTEXT = 0x189
VarSetCapacity(sss, 512)
}
;check active TC panel
GetTCPanels( pLeft, pRight)
cur := GetCurrentTCDir()
if (cur = pLeft)
if (panel = "right")
ControlSend, TMyListBox2, {TAB}, ahk_class TTOTAL_CMD
if (cur = pRight)
if (panel = "left")
ControlSend, TMyListBox1, {TAB}, ahk_class TTOTAL_CMD
if (panel = "right") or (panel="")
panel = TMyListBox1
else panel = TMyListBox2
loop
{
SendMessage LB_GETTEXT, A_Index, &sss, %panel%, ahk_class TTOTAL_CMD
if sss=
return 0
if (sss = fn)
{
SendMessage LB_GETTEXT, A_Index+1, &sss, %panel%, ahk_class TTOTAL_CMD
SendMessage, LB_SETCARETINDEX, A_Index, 1, %panel%, ahk_class TTOTAL_CMD
break
}
}
if (select)
{
ControlSend, %panel%, {INSERT}, ahk_class TTOTAL_CMD
if sss !=
ControlSend, %panel%, {UP}, ahk_class TTOTAL_CMD
}
return 1
}
;--------------------------------------------------------------------------
; set left and right panel and return source
;
GetTCPanels( ByRef pLeft, ByRef pRight)
{
ControlGetText pLeft, TMyPanel5, ahk_class TTOTAL_CMD
ControlGetText pRight, TMyPanel9, ahk_class TTOTAL_CMD
StringReplace pLeft, pLeft, \*.*
StringReplace pRight, pRight, \*.*
}
;--------------------------------------------------------------------------
GetCurrentTCDir()
{
ControlGetText src, TMyPanel2, ahk_class TTOTAL_CMD
StringReplace src, src, >
return src
}