Jump to content

IE.au3 ComboBox control.


Recommended Posts

  • Moderators

@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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

#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
Link to comment
Share on other sites

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)

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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()

 

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...