;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Прокрутка вкладок файловых панелей колёсиком (или тачем) мыши
; Скрипт создан для сборки TC DreamLair 2015
; Версия скрипта: 1.71
; Дата создания: 2014.06.15
; Автор скрипта: LonerD
; Фрагменты кода: Balderstrom, YMP и др.
; Сайт: http://dreamlair.net
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; В скрипте учтены следующие нюансы:
; - работа с активным окном Тотала (32 и 64 бита) (только если у них один конфиг-файл);
; - работа при нескольких запущенных копиях Тотала (только если у них один конфиг-файл);
; - работа при открытом/закрытом ftp-соединении;
; - работа при открытых деревьях в файловых панелях;
; - вращение колёсика под файловыми панелями.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#NoEnv
#NoTrayIcon
#KeyHistory, 0
#InstallMouseHook
#SingleInstance, force
SetBatchLInes, -1
SendMode Input
#IfWinActive, ahk_class TTOTAL_CMD
{
WheelDown::
WheelUp::
{
WinGet, TCHWND, ID, A
ControlGetFocus, aControl, % "ahk_id " TCHWND
MouseGetPos,,,, mControl
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SeparateTree := 0
Loop, 3
{
ControlGetText, TMyText%A_Index%, TMyListBox%A_Index%, % "ahk_id " TCHWND
ControlGetText, LCLText%A_Index%, LCLListBox%A_Index%, % "ahk_id " TCHWND
if ( TMyText%A_Index% = "W_TreeList2" || LCLText%A_Index% = "W_TreeList2" )
{
SeparateTree := 2
break
}
else if ( TMyText%A_Index% = "W_TreeList1" || LCLText%A_Index% = "W_TreeList1" )
SeparateTree := 1
}
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WinGet, TCPID, PID, A
TCArch := GetBitness(TCPID)
EnvGet, commander_path, commander_path
EnvGet, commander_ini, commander_ini
IniRead, RedirectLayout, % commander_ini, Layout, RedirectSection, 0
Transform, LayoutINI, Deref, % (RedirectLayout ? RedirectLayout : commander_ini)
LayoutINI := ExpandEnvVars (LayoutINI)
IniRead, DriveCombo, % LayoutINI, Layout, DriveCombo, 1
TMyTabControl1 := TCArch=32 ? "TMyTabControl1":"SysTabControl321"
TMyTabControl2 := TCArch=32 ? "TMyTabControl2":"SysTabControl322"
if ( DriveCombo = 0 )
{
TDrivePanel2 := TCArch=32 ? "TDrivePanel2":"Window5"
TMyPanel2 := TCArch=32 ? "TMyPanel2":"Window6"
TDrivePanel1 := TCArch=32 ? "TDrivePanel1":"Window3"
TMyPanel1 := TCArch=32 ? "TMyPanel1":"Window4"
TMyPanel6 := TCArch=32 ? "TMyPanel6":"Window10"
TMyPanel7 := TCArch=32 ? "TMyPanel7":"Window11"
TMyPanel9 := TCArch=32 ? "TMyPanel9":"Window15"
TMyPanel10 := TCArch=32 ? "TMyPanel10":"Window16"
}
else
{
TDrivePanel2 := TCArch=32 ? "TDrivePanel2":"Window4"
TMyPanel6 := TCArch=32 ? "TMyPanel6":"Window12"
TDrivePanel1 := TCArch=32 ? "TDrivePanel1":"Window3"
TMyPanel9 := TCArch=32 ? "TMyPanel9":"Window17"
TMyPanel4 := TCArch=32 ? "TMyPanel4":"Window8"
TMyPanel5 := TCArch=32 ? "TMyPanel5":"Window9"
TMyPanel7 := TCArch=32 ? "TMyPanel7":"Window13"
TMyPanel8 := TCArch=32 ? "TMyPanel8":"Window14"
}
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Loop, 3
TMyListBox%A_Index% := TCArch=32 ? "TMyListBox" . (SeparateTree + A_Index):"LCLListBox" . (SeparateTree + A_Index)
WinGet, TCControls, ControlList, % "ahk_id " TCHWND
TCFTPMode := 0
Loop, Parse, TCControls, `n, `r
{
if ( A_LoopField = TMyListBox3 )
{
TCFTPMode := 1
break
}
}
TMyListBoxL := TCArch=32 ? "TMyListBox" . (2 + SeparateTree + TCFTPMode):"LCLListBox" . (2 + SeparateTree + TCFTPMode)
TMyListBoxR := TCArch=32 ? "TMyListBox" . (1 + SeparateTree + TCFTPMode):"LCLListBox" . (1 + SeparateTree + TCFTPMode)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if( mControl = TDrivePanel2 || mControl = TMyPanel2 || mControl = TMyPanel6 || mControl = TMyPanel4 || mControl = TMyPanel5 ) ; || mControl = TMyTabControl1 )
{
DllCall("LockWindowUpdate", "uint", TCHWND)
TCTabScroll( A_ThisHotkey, (aControl != TMyListBoxL), 4001, 4002 )
DllCall("LockWindowUpdate", "uint", 0)
}
else if( mControl = TDrivePanel1 || mControl = TMyPanel1 || mControl = TMyPanel9 || mControl = TMyPanel10 || mControl = TMyPanel8 ) ; || mControl = TMyTabControl2 )
{
DllCall("LockWindowUpdate", "uint", TCHWND)
TCTabScroll( A_ThisHotkey, (aControl != TMyListBoxR), 4002, 4001 )
DllCall("LockWindowUpdate", "uint", 0)
}
else if( mControl = TMyPanel7 )
{
DllCall("LockWindowUpdate", "uint", TCHWND)
if ( DriveCombo = 0 )
TCTabScroll( A_ThisHotkey, (aControl != TMyListBoxL), 4001, 4002 )
else
TCTabScroll( A_ThisHotkey, (aControl != TMyListBoxR), 4002, 4001 )
DllCall("LockWindowUpdate", "uint", 0)
}
else
Send, {%A_ThisHotkey%}
Return
}
Return
}
#IfWinActive
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TCTabScroll( key, panelCheck, pane1, pane2 )
{
cmd := (key == "WheelUp" ? 3005 : 3006)
if( panelCheck )
{
PostMessage, 0x433, pane1
Sleep, 50
PostMessage, 0x433, cmd
PostMessage, 0x433, pane2
}
else
PostMessage, 0x433, cmd
Sleep, 100
Return
}
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GetBitness(Process) {
Process, Exist, %Process%
If !(PID := ErrorLevel)
return 0
hProcess := DllCall("OpenProcess", "uint", 0x400
, "uint", 0, "uint", PID, "ptr")
If (hProcess = 0)
return 0
res := DllCall("IsWow64Process", "ptr", hProcess, "int *", Wow64Process)
If (res = 0)
return 0
DllCall("CloseHandle", "ptr", hProcess)
return Wow64Process? 32:64
}
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ExpandEnvVars(ppath)
{
VarSetCapacity(Dest, 2000)
DllCall("ExpandEnvironmentStrings", Str, ppath, Str, Dest, Int, 1998)
Return, Dest
}
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |