VeeDub Posted August 3, 2006 Share Posted August 3, 2006 Hi,I am having trouble trying to use _IEFormElementCheckBoxSelect, which I think is the correct function I should be using to select/un-select a box on this pageHere's the code that I am using to try and un-tick the box$oForm = _IEFormGetObjByName($o_IE,"f-listingsSearchForm") _IEFormElementCheckBoxSelect ($oForm, "serviceArea", "", 0, "byValue")The error message I get is--> IE.au3 Error from function _IEFormElementGetValue, $_IEStatus_InvalidObjectType ThanksVW Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted August 3, 2006 Moderators Share Posted August 3, 2006 This one was a little more difficult that most. #include <IE.au3> $sURL = "http://www.yellowpages.com.au/search/listingsSearch.do?businessType=travel" & _ "&businessName=&bookId=1&headingCode=24740&locationClue=sydney&ul.longitude=&ul." & _ "latitude=&ul.streetNumber=&ul.street=&ul.suburb=®ionId=®ion=australia&showAllAdPoints" & _ "=false&lruPageNumber=1&familyId=&suburbPostcode=&pageNumber=1&serviceAreaModifiedByUser=true" & _ "&sortBy=mostInfo&userFreeFormAddress=Street+Number+%26+Name&userSuburb=Suburb%2C+Town%2C+City%2C+" & _ "State&userState=Select+State+---%3E&refineLocationSearch=false&stateId=1&areaId=1054&localityId=&adPs=&adPs=&adPs=&adPs=&adPs=&rankType=1" $oIE = _IECreate ($sURL, 1) $oCheckBox = _IEGetObjByName($oIE, "serviceArea") If Not $oCheckBox.checked Then $oCheckBox.checked = True $oCheckBox.fireEvent ("onclick") EndIf Link to comment Share on other sites More sharing options...
VeeDub Posted August 3, 2006 Author Share Posted August 3, 2006 This one was a little more difficult that most. $oCheckBox = _IEGetObjByName($oIE, "serviceArea") If Not $oCheckBox.checked Then $oCheckBox.checked = True $oCheckBox.fireEvent ("onclick") EndIf[/autoit]Hi Big_Daddy, Thanks for your help, I spent sometime trying to get this to work before I posted. Your logic to check whether the CheckBox was checked or not works great, which was what I was stuck on. For some reason the $oCheckBox.fireEvent ("onclick") would not check the box for me, but this statement worked instead _IEAction($oCheckBox,"click") Thanks VW Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted August 3, 2006 Moderators Share Posted August 3, 2006 Hi Big_Daddy, Thanks for your help, I spent sometime trying to get this to work before I posted. Your logic to check whether the CheckBox was checked or not works great, which was what I was stuck on. For some reason the $oCheckBox.fireEvent ("onclick") would not check the box for me, but this statement worked instead _IEAction($oCheckBox,"click") Thanks VWThat line does not check the box, it actually fires the onclick event for the checkbox. This line checks the box: $oCheckBox.checked = True Link to comment Share on other sites More sharing options...
DaleHohm Posted August 3, 2006 Share Posted August 3, 2006 Interesting... This was designed to work such that the following three lines would have done the trick: $oIE = _IECreate($url) $oForm = _IEFormGetObjByName($oIE, "f-ListingsSearchForm") _IEFormElementCheckBoxSelect($oForm, "on") _IEFormElementCheckBoxSelect will check the box and will trigger the commonly used onchange event for the element. Unfortunately, this page is coded to use the onclick event to trigger the action instead of onchange. I may want to trigger both onchange and onclick events for this function (and the related ones)... I'll give this some thought. 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...
Moderators big_daddy Posted August 3, 2006 Moderators Share Posted August 3, 2006 Interesting... This was designed to work such that the following three lines would have done the trick: $oIE = _IECreate($url) $oForm = _IEFormGetObjByName($oIE, "f-ListingsSearchForm") _IEFormElementCheckBoxSelect($oForm, "on") _IEFormElementCheckBoxSelect will check the box and will trigger the commonly used onchange event for the element. Unfortunately, this page is coded to use the onclick event to trigger the action instead of onchange. I may want to trigger both onchange and onclick events for this function (and the related ones)... I'll give this some thought. DaleThis one threw me for a few minutes. I actually had to look at the code for _IEFormElementCheckBoxSelect to see why it wasn't working. I just happened to notice the onchange/onclick difference. Link to comment Share on other sites More sharing options...
DaleHohm Posted August 3, 2006 Share Posted August 3, 2006 This one threw me for a few minutes. I actually had to look at the code for _IEFormElementCheckBoxSelect to see why it wasn't working. I just happened to notice the onchange/onclick difference.I should have given you kudos on your solution. I really appreciate the investment you've made in understanding the library and providing support.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...
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