Jump to content

Internet Explorer: the exact amount scrolled vertically


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...