rejectpenguin Posted May 14, 2008 Share Posted May 14, 2008 (edited) How can I execute a command or do something in my script if _IEFormGetObjByName can't find the form? EDIT: I keep on getting an error "--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType" and im figuring it has to do with the the function trying to find the form when there is none. Edited May 14, 2008 by rejectpenguin Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 14, 2008 Share Posted May 14, 2008 post your whole code. Or at least the relevant parts. [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
rejectpenguin Posted May 14, 2008 Author Share Posted May 14, 2008 Pretty much its looping before a page has fully loaded so the form isn't available when the loop first begins.. while 1 $oForm = _IEFormGetObjByName ($oIE, "superstore") $1nonce = _IEFormElementGetObjByName ($oForm, "nonce") $nonce = _IEFormElementGetValue ($1nonce) sleep(200) wend Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 14, 2008 Share Posted May 14, 2008 try putting in a sleep function for like 5 seconds. You could also try to loop over and over until the form finally went through. I would use ieloadwait though. _IELoadWait -------------------------------------------------------------------------------- Wait for a browser page load to complete before returning. #include <IE.au3> _IELoadWait ( ByRef $o_object [, $i_delay = 0 [, $i_timeout = -1]] ) Parameters $o_object Object variable of an InternetExplorer.Application or DOM element $i_delay Optional: Milliseconds to wait before checking status $i_timeout Optional: Period of time to wait before exiting function (default = 300000 ms aka 5 min) Return Value Success: Returns 1 Failure: Returns 0 and sets @ERROR @Error: 0 ($_IEStatus_Success) = No Error 1 ($_IEStatus_GeneralError) = General Error 3 ($_IEStatus_InvalidDataType) = Invalid Data Type 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout 8 ($_IEStatus_AccessIsDenied) = Access Is Denied 9 ($_IEStatus_ClientDisconnected) = Client Disconnected @Extended: Contains invalid parameter number Remarks Several IE.au3 functions call _IELoadWait() automatically (e.g. _IECreate(), _IENavigate() etc.). Most functions that do this also allow you to turn this off with a $f_wait parameter if you do not want the wait or if you want to call it yourself. When document objects or DOM elements are passed to _IELoadWait, it will check the readyState of the container elements up to and including the parentwindow. Browser scripting security restrictions may sometimes prevent _IELoadWait from guaranteeing that a page is fully loaded and can occasionally result in untrapped errors. In these cases you may need to avoid calling _IELoadWait and attempt to employ other methods of insuring that the page load has completed. These methods might include using a Sleep command, examining browser status bar text and other methods. When using functions that call _IELoadWait for objects other than the InternetExplorer (browser) object, you may also be successful by calling _IELoadWait for the browser yourself (e.g. _IELoadWait($oIE)). The most common causes of trouble are page redirects and cross-site scripting security restrictions associated with frames. Page re-writing techniques employed by some applications (e.g. Gmail) can also cause trouble here. [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
rejectpenguin Posted May 14, 2008 Author Share Posted May 14, 2008 Since im trying to refresh a page over and over any delay causes a major decrease in performence. I can't do a sleep or an loadwait as I want the code to execute as soon as the form becomes available. If im correct im pretty sure the forms load before images which is why I dont want to do a Ieloadwait. Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 14, 2008 Share Posted May 14, 2008 disable pics [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
rejectpenguin Posted May 14, 2008 Author Share Posted May 14, 2008 Your no help... Link to comment Share on other sites More sharing options...
DaleHohm Posted May 14, 2008 Share Posted May 14, 2008 "--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType"This is telling you that $oIE is not an object variable. Check your logic leading into this.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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 14, 2008 Share Posted May 14, 2008 How can I execute a command or do something in my script if _IEFormGetObjByName can't find the form? EDIT: I keep on getting an error "--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType" and im figuring it has to do with the the function trying to find the form when there is none. Just test the return value from _IEFormGetObjByName() to see if it's valid before trying to use it: while 1 $oForm = _IEFormGetObjByName ($oIE, "superstore") If IsObj($oForm) Then $1nonce = _IEFormElementGetObjByName ($oForm, "nonce") $nonce = _IEFormElementGetValue ($1nonce) EndIf sleep(200) wend 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 Link to comment Share on other sites More sharing options...
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