Using IE COM, how can I scroll to bottom of page? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Using IE COM, how can I scroll to bottom of page?

11 Sep 2018, 17:19

I could end up focusing the browser window and then using Send {End}, but for curiosity's sake, I'd like to get it done with COM. (It'd be slightly more fluid too, letting me do stuff in the meantime while I wait on webpages to load instead of having to leave it focused.)

I've tried stuff like ie.scroll(0,99999) and ie.window.scroll(0,99999) and ie.scrollTo(0,ie.document.body.scrollHeight) with no luck. They all give me an error "Unknown Name" and point to that line.
User avatar
kczx3
Posts: 932
Joined: 06 Oct 2015, 21:39

Re: Using IE COM, how can I scroll to bottom of page?

11 Sep 2018, 19:39

Seems like you were close. Try your last version again but with ie.window.scrollTo
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: Using IE COM, how can I scroll to bottom of page?

11 Sep 2018, 20:32

Didn't work:

Code: Select all

---------------------------
&Test Script.ahk
---------------------------
Error:  0x80020006 - Unknown name.

Specifically: window

	Line#
	375: {
	376: if (ex.Range("N" A_Index).DisplayFormat.Interior.Color != 6249471)  
	377: Continue
	378: if (ex.Range("N" A_Index).value="")  
	379: Break
	381: ie.Navigate(website)  
	382: IELoad(ie)  
--->	407: ie.window.scrollTo(0,ie.document.body.scrollHeight) ; jump to the bottom for manual pressing
	410: IELoad(ie)  
	411: }
	412: Hotkey,Esc,EscAuto,Off
	413: ToolTip
	414: Return
	417: MsgBox,You got stuck on %pk%.

This script will now close.
	418: ExitApp

Continue running the script?
---------------------------
Yes   No   
---------------------------


I'm on Windows 8.1 using IE 11 if that matters.
User avatar
kczx3
Posts: 932
Joined: 06 Oct 2015, 21:39

Re: Using IE COM, how can I scroll to bottom of page?  Topic is solved

11 Sep 2018, 20:33

Well it’s complaining about the window property. Try ie.document.parentWindow.scrollTo
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: Using IE COM, how can I scroll to bottom of page?

11 Sep 2018, 20:40

It's complained about scroll and scrollTo if I omitted window, will start trialing those in any combination I can think of.

Edit: That worked straight away. Thanks!

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], LeroyMcCheeks, neelsoon, paxton, TAC109, Tom Harding and 232 guests