flet Posted July 19, 2011 Posted July 19, 2011 (edited) 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 July 19, 2011 by flet
PsaltyDS Posted July 20, 2011 Posted July 20, 2011 You might try the window.pageXOffset and window.pageYOffset properties. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Spiff59 Posted July 20, 2011 Posted July 20, 2011 (edited) 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 July 20, 2011 by Spiff59
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now