Page 1 of 1

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

Posted: 11 Sep 2018, 17:19
by Exaskryz
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.

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

Posted: 11 Sep 2018, 19:39
by kczx3
Seems like you were close. Try your last version again but with ie.window.scrollTo

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

Posted: 11 Sep 2018, 20:32
by Exaskryz
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.

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

Posted: 11 Sep 2018, 20:33
by kczx3
Well it’s complaining about the window property. Try ie.document.parentWindow.scrollTo

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

Posted: 11 Sep 2018, 20:40
by Exaskryz
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!