WebBrowser reloads to center rather than top of page

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
srt
Posts: 12
Joined: 16 Mar 2024, 08:38

WebBrowser reloads to center rather than top of page

Post by srt » 14 Apr 2024, 01:37

Ahk is used to switch between BrowserTabs(chrome/edge) & reload them automatically.
However the browser reloads to the center as opposed to the top of the page .

An additional

Code: Select all

Click,1,1850,100,Left Sleep(10) Home
is appended to the script to move the scrollbar to the Top of the page,but it doesn't work.

What could be preventing this action ?

Code: Select all

;Switch between BrowserTabs &  Relaod them automatically  
NumpadEnd::SendInput,^1 Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadDown:: SendInput,^2 Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadPgDn:: SendInput,^3 Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadLeft::SendInput,^4 Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadClear::SendInput,^5 Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadRight::SendInput,^6 Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadHome::SendInput,^7 Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadUp::SendInput,^8 Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadPgUp::SendInput,^9 Sleep(10) ^r Sleep(100) Click,1,1920,10,Left Sleep(100 Home
NumpadIns::SendInput,^{PgUp} Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home
NumpadDel::SendInput,^{PgDn} Sleep(10) ^r Sleep(100)  Click,1,1850,100,Left Sleep(10) Home

User avatar
boiler
Posts: 16996
Joined: 21 Dec 2014, 02:44

Re: WebBrowser reloads to center rather than top of page

Post by boiler » 14 Apr 2024, 04:46

You can’t put multiple commands on the same line like that. If you think that you are embedding Sleep commands in the Send even before you append the other stuff, you are not. You are just sending a bunch of keystrokes that are likely not being received by the window/control that is active when you send it. Try having Notepad active when you press the hotkey so you can see you are just sending that text, not executing any commands.

I’m not saying this will have your desired effect, but this is the correct syntax for one of the hotkeys (fixing multiple issues):

Code: Select all

NumpadEnd::
	SendInput,^1
	Sleep, 10
	SendInput ^r
	Sleep, 100
	Click, 1850, 100
	SendInput, {Left}
	Sleep, 10
	SendInput, {Home}
return

Post Reply

Return to “Ask for Help (v1)”