Jump to content
Sign in to follow this  
flet

Internet Explorer: the exact amount scrolled vertically

Recommended Posts

flet

Is there a way to find out how much my Internet Explorer window has scrolled down? In my script I'm trying to move my mouse to an advertisement that is near the bottom of the page (page length is different each time) to be able to make a screenshot of it or to right-click it -> save as. Downloading the image with InetGet($url, $filename) doesn't work here, because the image src is generated by a script that places a random ad and I usually don't get the same advertisement twice in a row.

I'd like to use $object.scrollintoView for this, because it gets the ad perfectly into view, but if I want to move my mouse cursor to it I need to substract the amount scrolled down vertically from the y-coordinate of the advertisement image to move my mouse to it correctly. So I want to know how much I scrolled down vertically.

Right now I'm using $oIE.document.parentwindow.scrollBy(0, $y-amount) but it's really gambling and hoping that the advertisement is in view.

Can $oIE.document.body.scrollHeight or $oIE.document.body.clientHeight be of any use? I don't have much knowledge of MSDN or something. I found all these things via the search on this forum. I probably have to thank Dale :)

Is there anyone who came across this problem earlier and has a solution for me or good pointers in the right direction?

Thanks

Edited by flet

Share this post


Link to post
Share on other sites
Spiff59

I did something somewhat related in the broken script in my sig.

I've never tried PsaltyDS's suggested method, and it likely works better.

I needed to know if a certain element (an autoit code snippet) was on-screen.

The route I went was calculating the position of the webpage using the .screentop and .scrolltop properties, then enumerating the elements on the webpage and scanning that collection for a target tag. By comparing the .offsettop and .offsetparent properties of the target to the .screentop and .scrolltop values I could tell if (and where) the tag/element was on-screen.

Edited by Spiff59

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.