AutoHotkey: ScrollLock functionality

From TotalcmdWiki
Revision as of 14:06, 25 September 2005 by Sheepdog (talk | contribs)
Jump to navigation Jump to search

The first script locks the cursor on the current file/folder while scrolling through the filelist with 'ScrollLock' key


; Total Commander:

; Scroll without moving the cursor if ScrollLock is turned on.

$Down:: TCScroll( 1 )
$Up:: TCScroll( 0 )


TCScroll( xnDirecton )
{
	GetKeyState, sScrollLockState, ScrollLock, T

	if (not WinActive( "ahk_class TTOTAL_CMD" )) or (sScrollLockState != "D")
	{
		if (xnDirecton = 1)
			Send {Down}
		else
			Send {Up}
		Return
	}

	ControlGetFocus sActivePanel, A
	PostMessage 0x115, xnDirecton, 0, %sActivePanel%, A
	Return
}

The second script allows you to scroll through the filelist without changing the cursor position in the file window by pressing [Ctrl]+[shift]+[Up/Down]. Thus you could always see the predecessor and the successor of a file. If you rather like to use [AltGr]+[Shift]+[Up/down] simply replace the first 3 lines of the script by the following

; Scroll, keeping the cursor in place
<^>!+Down:: TCScrollKeep( 1 )
<^>!+Up:: TCScrollKeep( 0 )

Here is the second script:

; Scroll, keeping the cursor in place
^+Down:: TCScrollKeep( 1 )
^+Up:: TCScrollKeep( 0 )

TCScrollKeep( xnDirecton )
{
	if WinActive( "ahk_class TTOTAL_CMD" )
	{
		if xnDirecton = 1
			Send {Down}
		else
			Send {Up}
	ControlGetFocus sActivePanel, A
	PostMessage 0x115, xnDirecton, 0, %sActivePanel%, A
	}
	Return
}


Back to AutoHotkey