- Local time
- 6:33 AM
- Posts
- 4,617
- OS
- Windows 11 Pro
here. this AHK will do it for you. save the attached .zip, extract the EXE and pin it to your taskbar (just for ease of access). it will:
- Prompt for Start Page
- Prompt for End Page
- Tell you to bring Word Document to Active window, then click OK on prompt
- Highlight from the Bottom of the End Page to the Top of the Start Page
content of EXE:
- Prompt for Start Page
- Prompt for End Page
- Tell you to bring Word Document to Active window, then click OK on prompt
- Highlight from the Bottom of the End Page to the Top of the Start Page
content of EXE:
Code:
#SingleInstance Force
; --- Prompt for start page ---
InputBox, PageStart, Start Page, Enter the START page number:, , 250, 150
if ErrorLevel
ExitApp
; --- Prompt for end page ---
InputBox, PageEnd, End Page, Enter the END page number:, , 250, 150
if ErrorLevel
ExitApp
; --- Prompt to activate Word (always on top) ---
MsgBox, 0x40000, Activate Word, Activate the Word window, then press OK.
WinWaitActive, ahk_exe WINWORD.EXE, , 5
if ErrorLevel {
MsgBox, 16, Error, Word window was not activated.
ExitApp
}
try {
word := ComObjActive("Word.Application")
} catch {
MsgBox, 16, Error, Could not connect to Word. Make sure a document is open.
ExitApp
}
; Ensure Print Layout
word.ActiveWindow.View.Type := 3 ; wdPrintView
; --- Go to END page ---
word.Selection.GoTo(1, 1, PageEnd) ; wdGoToPage = 1
word.Selection.EndKey(6) ; wdStory = 6 (end of page/section)
; --- Shift+PAGE UP to end of START page ---
Loop
{
currentPage := word.Selection.Information(3) ; wdActiveEndPageNumber = 3
if (currentPage <= PageStart)
break
SendInput, +{PgUp}
Sleep, 30
}
; --- Shift+UP to the TOP of the start page ---
Loop
{
prevPage := word.Selection.Information(3)
SendInput, +{Up}
Sleep, 10
newPage := word.Selection.Information(3)
if (newPage < prevPage) {
SendInput, +{Down}
break
}
if (word.Selection.Information(7) = 1) ; wdVerticalPositionRelativeToPage
break
}
; --- Apply highlight ---
word.Selection.Range.HighlightColorIndex := 7 ; Yellow
MsgBox, 64, Done, Highlight applied from page %PageStart% to %PageEnd%.
ExitApp
Attachments
My Computer
System One
-
- OS
- Windows 11 Pro






