Jump to content
duzers

IE.au3 ComboBox control.

Recommended Posts

JLogan3o13

@duzers welcome to the forum. The page does not load for me, but my first question would be, what have you tried on your own? Reading through the help file and the Wiki on the _IE* functions, or searching through the forum for the Chrome UDF should give you an idea of how to interact with web pages.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
duzers

I can do many things with AutoIt but this problem is not solved by me in an elegant way. This is the reason why I'm here.

Share this post


Link to post
Share on other sites
duzers
#include <IE.au3>
#include <MsgBoxConstants.au3>
Opt("WinTitleMatchMode", 2)

$sUrl = "https://www.supermakler.pkobp.pl/plus/demo/main.html?id=FZ&fz=true&tytul=Nowe%20zlecenie"
$iTryAttach = 1
$iVisible = 1
$iWait = 1
$iTakeFocus = 0

$oIE = _IECreate($sUrl, $iTryAttach, $iVisible, $iWait, $iTakeFocus)
_idFields()

Func _idFields()
    $num = 1
    $colForms = _IEFormGetCollection($oIE) ; get all forms
    If @error Then Return SetError(1, @error, 0)

    For $oForm In $colForms ; loop over form collection
        ConsoleWrite("---- FORM " & $oForm.name & " --------------------" & @CRLF)

        $oFormElements = _IEFormElementGetCollection($oForm) ; get all elements
        if @error Then Return SetError(2, @error, 0)

        For $oFormElement In $oFormElements ; loop over element collection

            If StringInStr("input,textarea", $oFormElement.tagName) Then ; it is an input or textarea

                If StringInStr("button,reset,submit", $oFormElement.type) Then ContinueLoop;skip to next entry if type is button,hidden,reset,submit (file,password?)
                ConsoleWrite("> input." & $oFormElement.type & " " & $oFormElement.name & @CRLF)

                If $num == 1 Then  _IEAction($oFormElement, "click")
                If $num == 3 Then _IEFormElementSetValue($oFormElement, "*", 1)
                If $num == 5 Then _IEFormElementSetValue($oFormElement, "ACLP", 1) ; set value of the field
            EndIf
            $num += 1
        Next
    Next
EndFunc   ;==>_idFields

Run twice.

It is fill forms but after click "Wyslij" (eng. Submit) I get warning "Value in the box 'Walor' is required". Form doesn't see new value.

Edited by duzers

Share this post


Link to post
Share on other sites
Danp2

Not sure if this works (that's one strange site), but this is how I would write it --

#include <IE.au3>

$sUrl = "https://www.supermakler.pkobp.pl/plus/demo/main.html?id=FZ&fz=true&tytul=Nowe%20zlecenie"

$oIE = _IECreate($sUrl)

Do
    Sleep(500)
    $oForm = _IEFormGetCollection($oIE, 0)
Until @error = $_IESTATUS_Success

_IEFormElementRadioSelect($oForm, 0, "gxt.RadioGroup.0", 1, 'byIndex')

$oInput = _IEGetObjById($oIE, "x-auto-37-input")
_IEFormElementSetValue($oInput, "*")

$oInput = _IEGetObjById($oIE, "x-auto-40-input")
_IEFormElementSetValue($oInput, "ACLP")

_IEFormSubmit($oForm)

 

Share this post


Link to post
Share on other sites
duzers

No it is not working properly. I will try something like this:

For $a In _IETagNameGetCollection($oIE, "a")
               If StringInStr(_IEPropertyGet($a, "innerText"), "Like") Then
                   For $i = 1 To $repeat
                        $a.fireEvent("onmousedown")
                        $a.fireEvent("onmouseup")
                        _IEAction($a, "click")
                        _IELoadWait($oIE)
                   Next
               EndIf
           Next

 

Share this post


Link to post
Share on other sites
duzers

Input "x-auto-40-input" is not updating.

 

Share this post


Link to post
Share on other sites
Subz

The problem filling in the fields is that it doesn't trigger the required action you can try:

#include <IE.au3>

$sUrl = "https://www.supermakler.pkobp.pl/plus/demo/main.html?id=FZ&fz=true&tytul=Nowe%20zlecenie"
$oIE = _IECreate($sUrl, 1)
_IELoadWait($oIE)

$oNowe_zlecenie = _IEGetObjById($oIE, "x-auto-31")
$oNowe_zlecenie.Click

$oNowe_zlecenie = _IEGetObjById($oIE, "x-auto-37-input")
$oNowe_zlecenie.NextSibling.Click()
$oNowe_zlecenie.Value = "P"
$oNowe_zlecenie.NextSibling.Click()

$oNowe_zlecenie = _IEGetObjById ($oIE, "x-auto-40-input")
$oNowe_zlecenie.NextSibling.Click()
$oNowe_zlecenie.Value = "ACLP"
$oNowe_zlecenie.NextSibling.Click()

$oNowe_zlecenie = _IEGetObjById ($oIE, "x-auto-51-input")
$oNowe_zlecenie.Click()

Or for the main page use:

#include <IE.au3>

$sUrl = "https://www.supermakler.pkobp.pl/plus/demo/"
$oIE = _IECreate($sUrl, 1)
_IELoadWait($oIE)

$oNowe_zlecenie = _IEGetObjById($oIE, "x-auto-264")
$oNowe_zlecenie.Click

$oNowe_zlecenie = _IEGetObjById($oIE, "x-auto-270-input")
$oNowe_zlecenie.NextSibling.Click()
$oNowe_zlecenie.Value = "P"
$oNowe_zlecenie.NextSibling.Click()

$oNowe_zlecenie = _IEGetObjById ($oIE, "x-auto-273-input")
$oNowe_zlecenie.NextSibling.Click()
$oNowe_zlecenie.Value = "ACLP"
$oNowe_zlecenie.NextSibling.Click()

$oNowe_zlecenie = _IEGetObjById ($oIE, "x-auto-284-input")
$oNowe_zlecenie.Click()

 

  • Like 1

Share this post


Link to post
Share on other sites
duzers

Thank You!

I didn't know that there is a function like ".NextSibling.Click()".

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

×