brokensword02 Posted March 5, 2011 Posted March 5, 2011 (edited) Hello everybody , i'm trying a scrip in autoit to do something in firefox a lot of times. My problem is that sometimes , the page takes more time to load and then the movement of the mouse might be late or sooner than the loading. Is there any way to tell him to execute the action just after the page finishes loading ? Thanks ! Edited March 5, 2011 by brokensword02
huskies Posted March 5, 2011 Posted March 5, 2011 don't know about firefox, but in IE there is a function that does that, IELoadWait or something, so I imagine they must have one for FF, look in the help file for it <It Shall Be Done>
brokensword02 Posted March 5, 2011 Author Posted March 5, 2011 Yeah I checked , but it only works the first time you launch IE with Run("...\IE.exe) Then it's gonna wait the page to load to continue the script. But i would want something to make a pause between two actions and tell the next one to wait for the page to load. Not just at the beginning.
DW1 Posted March 5, 2011 Posted March 5, 2011 (edited) Try using the IE functions. You can create your own instance of IE, hidden or shown, as well as attach to existing instances of IE. Then just navigate to the page you want to wait for with the IE functions, and put something like _IEPropertyGet($oIE, "busy") in a loop until it is no longer working on loading the page. EDIT: The IE function _IENavigate has a built in option for waiting for the page to load. So you have many options. Here are a few that would work: #include <IE.au3> _IEErrorHandlerRegister() $oIE = _IECreate("about:blank") _IENavigate($oIE, "http://www.autoitscript.com/forum/index.php"); (Default) Wait for page load to complete before returning MsgBox(0, 'Done', 'Done loading page') _IEQuit($oIE) ;OR WITH IE PROPERTY $oIE = _IECreate("about:blank") _IENavigate($oIE, "http://www.autoitscript.com/forum/index.php", 0) ;Return immediately, not waiting for page to load While _IEPropertyGet($oIE, "busy") = True Sleep(50); wait while IE is busy WEnd MsgBox(0, 'Done', 'Done loading page' & @CRLF & "-Open your own instance of IE for the next method.") _IEQuit($oIE) ;OR WITH ATTACH $oIE = _IEAttach('', 'Instance') If @error Then MsgBox(0, 'Error', 'No instance of IE to attach to.') Else _IENavigate($oIE, "http://www.autoitscript.com/forum/index.php") ;Default) Wait for page load to complete before returning MsgBox(0, 'Done', 'Done loading page') _IEQuit($oIE) EndIf Edited March 5, 2011 by danwilli AutoIt3 Online Help
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