Jump to content

Pfffft, Proudness can hold people back


Recommended Posts

I seem to fail to grasp the checkbox on webpages.

After extensive search on this forum i don't seem to find the solution, also the help file can't help me.

Maybe one of you, here goes:

'The Checkbox is not reqognized'

A rather common question reading on this forum :whistle:

$o_IE = _IECreate()
     
     _IENavigate ($o_IE, "http://www.binsearch.info/?q=" & $PostBin, 1)
     _IELoadWait ($o_IE)
        Sleep(1000)
        
        $oForm = _IEFormGetObjByName ($o_IE, "checkbox")
                _IEFormElementCheckboxSelect ($oForm, "9961946", "", 1, "byValue")

As you see the checkbox name is rather strange, but I can't find it, in the end run i'll change "$o_IE = _IECreate()" to "$o_IE = _IECreate(0)" as the action don't need to be done visible.

but could you tell me a way to detect if there are more then 1 checkboxes?

There is always 1 available, but there could be more, which have to be checked also.

And is it possible via a hidden IE window?

Forgive me my lame explanation, but it is late, and i was to proud to ask the question earlier, i thought i could solve it myself :)

It simple:

The checkbox should be checked, and a way to find if there are more checkboxes and check them to.

OnLy thing is, i don't trust the name of the checkbox.

Kind Regards, Starf0x

Link to comment
Share on other sites

  • Moderators

This should check every checkbox on the page.

#include <IE.au3>

$PostBin = ""

_IEErrorHandlerRegister()

$oIE = _IECreate("http://www.binsearch.info/?q=" & $PostBin)

$oInputs = _IETagNameGetCollection($oIE, "INPUT")
For $oInput In $oInputs
    If $oInput.type = "checkbox" Then
        If Not $oInput.checked Then
            _IEAction($oInput, "click")
            _IELoadWait($oIE)
        EndIf
    EndIf
Next
Link to comment
Share on other sites

It did the job thank you, but...

I don't want to bother people with a IE window, should i call a hide, or is the _IECreate(0) not possible with this kind of actions?

Kind Regards, Starf0x

It is still possible. Please see _IECreate in the helpfile however as the order of parameters for $f_visible has changed.

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

  • 1 month later...

I've been trying to set checkboxes by name all day long and finally came to the conclusion that it must a bug in _IEFormElementCheckboxSelect(). I've succeeded by applying a home made patch :)

I would love to hear your ideas about or experience with this possible bugfix.

Here's the story:

After studying the _IEFormElementCheckboxSelect function I noticed two things considering the above code-example. The syntax in the above example should have been like this

_IEFormElementCheckboxSelect ($oForm, "[b]on[/b]", "[b]9961946[/b]", 1, "byValue")oÝ÷ Ù·jë¢[r¥oÝ÷ Ú)í¡«­¢+ØÀÌØí½%ѵÌôáÕÑ ÅÕ½ÐìÀÌØí½}½©Ð¹±µ¹ÑÌ ÌäìÅÕ½ÐìµÀìÀÌØíÍ}9µµÀìÅÕ½ÐìÌäì¤ÅÕ½Ðì¤oÝ÷ ÚÊ"µÆ§­ën®w!yÉ£¬Â+a¶zÈ«yÙÚà'u§]yÛ(ç(uæµê÷ô&¬z«¨µ¼j[ªê-ßÖ§wBjǪº[ÈÝ{®¢Ýýjëh×6If ObjName($oItems) = "DispHTMLInputElement" Then
; not all code displayed here, see attachment for full code

to detect whether it found one or more checkboxes

Here's my IE.au3 file (not thouroughly tested though) IE.au3.zip

If I messed things up, please be gentle with me :P

Info: I'm using AutoIt V3 with SciTE v1.71 and an English Internet Explorer version 6.0.3790.1830 with SP1 installed on a Windows 2003 server.

Edited by martijn
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...