Noobster24 Posted November 2, 2007 Posted November 2, 2007 (edited) Hi,I try to open a IE window (with _IECreate() ), after loading the website, the page must be scrolled down. In Javascript it's possible by using window.scroll().So, this is what I tried:#include <IE.au3> $oIE = _IECreate("http://www.mediacollege.com/internet/javascript/page/scroll.html",0,1,1,0) _IEHeadInsertEventScript ($oIE, "window", "onload", "window.scroll(0,150);")Unfortunately this doesn't work for some reason, however this one works:#include <IE.au3> $oIE = _IECreate("http://www.mediacollege.com/internet/javascript/page/scroll.html",0,1,1,0) _IEHeadInsertEventScript ($oIE, "window", "onbeforeunload", "window.scroll(0,150); alert('It scrolls');")But that's 'onbeforeunload', I would like to use 'onload' (like in my first codesample).Anyone got an idea how to solve this?Thanks in advance,AndreasPS:Yes I read this topic: http://www.autoitscript.com/forum/index.ph...=window++onloadbut I can't get it working still. Edited November 2, 2007 by Noobster24 Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.
DaleHohm Posted November 2, 2007 Posted November 2, 2007 _IECreate, by default, does not give control back to your script until the onload event has already fired. So, just as in the other thread you reference it is silly to write an onload event to the page after it has already loaded. That said, if your point is to scroll down on the page after it has loaded and your script gets control back right after it is loaded, why not just do this: include <IE.au3> $oIE = _IECreate("www.autoitscript.com") $oIE.document.parentwindow.scroll(0,150) Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
Noobster24 Posted November 2, 2007 Author Posted November 2, 2007 _IECreate, by default, does not give control back to your script until the onload event has already fired. So, just as in the other thread you reference it is silly to write an onload event to the page after it has already loaded. That said, if your point is to scroll down on the page after it has loaded and your script gets control back right after it is loaded, why not just do this: include <IE.au3> $oIE = _IECreate("www.autoitscript.com") $oIE.document.parentwindow.scroll(0,150) Dale Wow, works like a charm. You posted exactly what I searched for. Thanks again. Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.
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