Last active
August 19, 2023 01:08
-
-
Save imspzero/6c78ce18e72ef49b1e5fea33c82ddadb to your computer and use it in GitHub Desktop.
A simple AutoHotKey script to implement the half-page-scrolling in SumatraPDF. Maybe as a rescue : )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; --------Sumatra PDF hotkeys------------ | |
; Add a half-page-scroll-up-like functionality | |
; Configure here | |
scrollAmount = 8 | |
; Function: | |
; Check whether it is focusing on the PDF content, not other search input text boxes or windows. | |
; From Window Spy, I found that the "Focus Control" field is surprisingly "" | |
; when we are focusing the content. | |
CheckFocusOnContent(){ | |
ControlGetFocus, fvar, ahk_class SUMATRA_PDF_FRAME | |
if (StrLen(fvar) = 0) { | |
return 1 | |
}else{ | |
return 0 | |
} | |
} | |
; These key maps only activate when we are in SumatraPDF and actually focus on the PDF content, | |
; aka, not in the bookmark area or the search field | |
; I override the original "m" and "n" shortcuts here because I never use them. | |
#If WinActive("ahk_exe SumatraPDF.exe") and CheckFocusOnContent() | |
m::Send {WheelUp %scrollAmount%} ; fast scroll up the "scrollAmount" | |
n::Send {WheelDown %scrollAmount%} ; fast scroll down the "scrollAmount" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is no longer needed after installing the newer version of SumartraPDF.
We can make use of the new configuraiton like this: