Jump to content

Recommended Posts

Posted (edited)

What is the difference between this:

$pForm = _IEGetObjByID($oIE,"createKnownAccountNotifyForm")
_IEFormElementCheckBoxSelect($pForm,"print")

which is not working and this:

$pForm = _IEGetObjByID($oIE,"createKnownAccountNotifyForm")
$oPrint = _IEFormElementGetObjByName($pForm,"print")
_IEAction($oPrint,"click")

which does work.

Error:

--> IE.au3 T3.0-1 Warning from function _IEFormElementCheckBoxSelect, $_IESTATUS_NoMatch

The reason I am asking, the first example is what I really need.  The checkbox I am trying to check is done so multiple times for each time I need to print a form from a web portal.  I noticed that when I have to click multiple times that the checkbox sometimes stays checked, so when the second example runs it unchecks the checkbox.  I need for the checkbox to be verified first before check or just default to the checked status.

Edited by monarch684
Added error message
Posted

maybe here:

??

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Wait I see what you mean.

I get this

--> IE.au3 T3.0-1 Warning from function _IELinkClickByText, $_IESTATUS_NoMatch

When I run

_IEFormElementCheckBoxSelect($pForm,1,"",1,"byIndex")

 

Posted

Snippet of the code

<form class="validateable" notify-form="true" id="createKnownAccountNotifyForm">
    <input data-mini="true" type="checkbox"  value="true" name="print" class="custom" id="createKnownAccountNotifyFormPrint"/>
    <label for="createKnownAccountNotifyFormPrint">Print</label>
    <input data-mini="true" type="checkbox" name="email" class="custom" value="true"  id="createKnownAccountNotifyFormEmail"/>
    <label for="createKnownAccountNotifyFormEmail">Email</label>

    <blockquote> 
    
        <input data-mini="true" type="checkbox" name="copyMe" class="custom" value="true"  id="createKnownAccountNotifyFormCopyMe" checkbox-dependant="createKnownAccountNotifyFormEmail" disabled/>
        <label for="createKnownAccountNotifyFormCopyMe">Copy me</label>
        </blockquote>
</form>

The code in it's entirety is attached.

portal.html

Posted (edited)

So I made this test script:

#include <ie.au3>

_Example()
Func _Example()
    Local $oIE = _IECreate()
    ; REMARK:
    ; Copy to Clipboard HTML Snippet before run this example
    ; as this following line use it
    _IEDocWriteHTML($oIE, ClipGet())
    Local $pForm = _IEGetObjById($oIE, "createKnownAccountNotifyForm")
    _IEFormElementCheckBoxSelect($pForm, 1, "", 1, "byIndex")
EndFunc   ;==>_Example

 

this is ok, working well.

REMARK: you must copy to clipboard your HTML snippet from Post #6

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Bumping this topic as I really need to figure this out before next Monday.  This script is ran once a week and when it errors my guys have no clue how to click a button even though they have been instructed.

I have a thought on how to possibly approach this differently.  Throwing in a If Else statement.  I am at a lose on how to properly write the syntax.  Here is what I have:

Local $pForm = _IEGetObjById($oIE, "createKnownAccountNotifyForm")
   if StringInStr('<label class="ui-focus ui-checkbox-off ui-btn ui-btn-corner-all ui-mini ui-btn-icon-left ui-btn-up-a" for="createKnownAccountNotifyFormPrint" data-theme="a" data-mini="true" data-icon="checkbox-off" data-corners="true" data-shadow="false" data-iconshadow="true" data-wrapperEls="span"><span class="ui-btn-inner"><span class="ui-btn-text">Print</span><span class="ui-icon ui-icon-checkbox-off ui-icon-shadow">&nbsp;</span></span></label>','ui-checkbox-off') Then
      $oPrint = _IEFormElementGetObjByName($pForm,"print")
      _IEAction($oPrint,"click")
   Endif

This always returns true, so my script still unchecks the box.

Posted

Here is what I came up with.

if IsDeclared("sRan") Then
      if $sRan = 0 Then
         Local $pForm = _IEGetObjById($oIE, "createKnownAccountNotifyForm")
         $oPrint = _IEFormElementGetObjByName($pForm,"print")
         _IEAction($oPrint,"click")
         Global $sRan = 1
      EndIf

    Else
      Local $pForm = _IEGetObjById($oIE, "createKnownAccountNotifyForm")
      $oPrint = _IEFormElementGetObjByName($pForm,"print")
      _IEAction($oPrint,"click")
      Global $sRan = 1
   EndIf

 

Posted

Is this works for you now ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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
  • Recently Browsing   0 members

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