AutoHotkey: Keyboard navigation for Background Transfer Manager

From TotalcmdWiki
Revision as of 15:10, 28 November 2016 by StatusQuo (talk | contribs) (Note: old, function is now internally integrated into TC)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Old/outdated:
TC has integrated Tab functionality internally since at least version 7.56a, so this script is not needed any more.

This script does not work with TC 7.50 and above, due to the missing window class name of BTM there.

	; /////////////////////////////////////////////////////////////////////////////////
	; // TC_BTM_keyboard-navigation.ahk  (W) StatusQuo 2008  for TC 7.0x (up to 7.04a)
	; // 
	; // adds keyboard navigation to background transfer manager: 
	; // (Shift+)TAB, Del
	; /////////////////////////////////////////////////////////////////////////////////
	
#SingleInstance, Force
asControlNames := "ListBox1,Button1,Button2,Button3,Button4,Edit1,ListBox1"
Return

#IfWinActive, ahk_class DOWNDLGLIST2
	Del::	; === Remove selected download job(s)
		Send, {NumpadSub}
		Return
	Tab::	; === Focus next control in %asControlNames%
		ControlGetFocus, sFocus
		sLastControl := ""
		Loop, Parse, asControlNames, `,
		{
			if (sFocus = "")	; no focus at all
			{
				ControlFocus, ListBox1
				Break
			}
			if (sLastControl = sFocus)
			{
				ControlFocus, %A_LoopField%
				Break
			}
			sLastControl := A_LoopField
		}
		Return
	+Tab::	; === Focus previous control in %asControlNames%
		ControlGetFocus, sFocus
		sLastControl := ""
		Loop, Parse, asControlNames, `,
		{
			if (sFocus = "")	; no focus at all
			{
				ControlFocus, ListBox1
				Break
			}
			if (A_LoopField = sFocus)
			and (sLastControl != "")
			{
				ControlFocus, %sLastControl%
				Break
			}
			sLastControl := A_LoopField
		}
		Return

#IfWinActive

;

Back to AutoHotkey