Sign in to follow this  
Followers 0
pootie tang

Question about the function _IEFormElementCheckboxSelect

8 posts in this topic

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

Share this post


Link to post
Share on other sites



Gawd that was confusing, seeing who posted the question, then the one that answered it!!


[center]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.[/center]

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by big_daddy

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0