Ebenezer Posted March 30, 2006 Share Posted March 30, 2006 Hi everybody. I'm trying to read values from a search result page. When all values have been read the script should navigate to the next result page until it runs out of results. At this point the "next" button would be disabled. The "next" button is an form element of type submit. I tried the following code: Func _IE_formclick($ObjIE, $_find, $_form = 0) For $i = 1 To $ObjIE.document.forms ($_form) .elements () .length - 1 If StringInStr($ObjIE.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then $ObjIE.document.forms ($_form) .elements ($i) .click() Return 1 EndIf Next Return -1 EndFunc Unfortunately the script happily clicks the disabled button and returns "1". If someone could tell me how I can check if the button is disabled to exit my loop I would be grateful Note: I can't use _IEFormSubmit since there are two submit buttons (prev. and next). Thanks, Ebenezer Link to comment Share on other sites More sharing options...
DaleHohm Posted March 30, 2006 Share Posted March 30, 2006 (edited) Hi everybody. I'm trying to read values from a search result page. When all values have been read the script should navigate to the next result page until it runs out of results. At this point the "next" button would be disabled. The "next" button is an form element of type submit. I tried the following code: Func _IE_formclick($ObjIE, $_find, $_form = 0) For $i = 1 To $ObjIE.document.forms ($_form) .elements () .length - 1 If StringInStr($ObjIE.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then $ObjIE.document.forms ($_form) .elements ($i) .click() Return 1 EndIf Next Return -1 EndFunc Unfortunately the script happily clicks the disabled button and returns "1". If someone could tell me how I can check if the button is disabled to exit my loop I would be grateful Note: I can't use _IEFormSubmit since there are two submit buttons (prev. and next). Thanks, Ebenezer There is a .disabled boolean property you can check on the input element. It will be True if disabled, False by default. Dale Edit: typo Edited March 30, 2006 by DaleHohm 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...
Ebenezer Posted March 30, 2006 Author Share Posted March 30, 2006 So the syntax would be If $ObjIE.document.forms($_form).elements($i).disabled = "True" Then MsgBox(0, "", "Button is disabled") EndIf right? Sorry, I'm rather bad at this html/objects reference stuff :"> Link to comment Share on other sites More sharing options...
seandisanti Posted March 30, 2006 Share Posted March 30, 2006 (edited) So the syntax would be If $ObjIE.document.forms($_form).elements($i).disabled = "True" Then MsgBox(0, "", "Button is disabled") EndIf right? Sorry, I'm rather bad at this html/objects reference stuff :">right, but it may be easier to do something like: If Not $ObjIE.document.forms($_form).elements($i).disabled Then ;your click next page code EndIf ***edit*** forgot my Edited March 30, 2006 by cameronsdad 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