pootie tang Posted July 20, 2006 Share Posted July 20, 2006 Move this from a different forum Question about the function _IEFormElementCheckboxSelect I looked at the source to gather info about the checkbox, but it indicates that name but no value for the checkbox. how would I go about selecting it. Only 1 checkbox. Here's the sniplet from the source. <Input Type=Checkbox Name=cbMarkKeyExportable ID=cbMarkKeyExportable onclick="handleMarkExport(false);"><Label For=cbMarkKeyExportable ID=locMarkExportLabel>Mark keys as exportable</Label> I can use IEAction to click on it but without assuming the initial state of the checkbox, I can't tell with the click I am making is checking or unchecking the checkbox. Hopefully there is a way to do it with _IEFormElementCheckboxSelect w/o a value. Thanks in advance. Dave Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 20, 2006 Moderators Share Posted July 20, 2006 This is assuming that the form the checkbox is in is the first form on the page. $sURL = "www.your-webpage.com" $oIE = _IEAttach($sURL, "url") If Not IsObj($oIE) Then $oIE = _IECreate($sURL) EndIf $oForm = _IEFormElementGetCollection($oIE, 0) _IEFormElementCheckboxSelect ($oForm, 0, "cbMarkKeyExportable", 1, "byIndex") Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 20, 2006 Moderators Share Posted July 20, 2006 Gawd that was confusing, seeing who posted the question, then the one that answered it!! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
pootie tang Posted July 20, 2006 Author Share Posted July 20, 2006 This is assuming that the form the checkbox is in is the first form on the page. $sURL = "www.your-webpage.com" $oIE = _IEAttach($sURL, "url") If Not IsObj($oIE) Then $oIE = _IECreate($sURL) EndIf $oForm = _IEFormElementGetCollection($oIE, 0) _IEFormElementCheckboxSelect ($oForm, 0, "cbMarkKeyExportable", 1, "byIndex") I gave it a try but it didn't work. Nothing happens to the checkbox. I have attached the whole source from that page. Any help would be appreciated. Thanks. Dave Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 20, 2006 Moderators Share Posted July 20, 2006 (edited) I had _IEFormElementGetCollection where I should have had _IEFormGetCollection. $sURL = "www.your-webpage.com" $oIE = _IEAttach($sURL, "url") If Not IsObj($oIE) Then $oIE = _IECreate($sURL) EndIf $oForm = _IEFormGetCollection($oIE, 0) _IEFormElementCheckboxSelect ($oForm, 0, "cbMarkKeyExportable", 1, "byIndex") @Smoke - That is confusing! Edited July 20, 2006 by big_daddy Link to comment Share on other sites More sharing options...
pootie tang Posted July 20, 2006 Author Share Posted July 20, 2006 I had _IEFormElementGetCollection where I should have had _IEFormGetCollection. $sURL = "www.your-webpage.com" $oIE = _IEAttach($sURL, "url") If Not IsObj($oIE) Then $oIE = _IECreate($sURL) EndIf $oForm = _IEFormGetCollection($oIE, 0) _IEFormElementCheckboxSelect ($oForm, 0, "cbMarkKeyExportable", 1, "byIndex") @Smoke - That is confusing! Unfortunately, same behavior. Checkbox never checks. Link to comment Share on other sites More sharing options...
DaleHohm Posted July 20, 2006 Share Posted July 20, 2006 (edited) I'd like to point out that this block of code: $sURL = "www.your-webpage.com" $oIE = _IEAttach($sURL, "url") If Not IsObj($oIE) Then $oIE = _IECreate($sURL) EndIfoÝ÷ Ø&§mêÞ¦VyÜ"¶®¶sbb33c·5U$ÂÒgV÷C·wwrç÷W"×vV'vRæ6öÒgV÷C°¢b33c¶ôRÒôT7&VFRb33c·5U$ I noted that that construct was very common practice, so I incorporated the functionality in _IECreate. The second parameter is the $try_attach parameter that will first try an attach to a browser at that URL and then do a create if necessary. The @extended value will tell you if the attach succeeded or not. Dale @bigdaddy - wouldn't you rather be bigdaddyDave? Hint Hint Edited July 20, 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...
Moderators big_daddy Posted July 20, 2006 Moderators Share Posted July 20, 2006 It didn't like the name being in there for some reason. #include <IE.au3> $sURL = "www.your-webpage.com" $oIE = _IECreate($sURL, 1) $oForm = _IEFormGetCollection($oIE, 0) _IEFormElementCheckboxSelect ($oForm, 0, "", 1, "byIndex") @Dale - Thanks, I forgot all about that being there. 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