Jump to content

Recommended Posts

Posted

I'm trying to teach myself how to us the IE functions to help some tasks at work.

I have an application which WindowInfo is showing has a class of WindowsForms10.Window.9.app9.

This application has a bunch of checkboxes.  I want to check all boxes in the form. After reading the help files, I've successfully been able to attach to the application and read the innerhtml:

Local $hWnd = WinWait("[CLASS:WindowsForms10.Window.8.app9]", "", 10)

Local $oIE = _IEAttach($hWnd, "embedded")
_IEPropertyGet($oIE, "innerhtml")

Now, I can't for the life of me figure out how to check even a single box in the application.  I've read the helpfile for _IEFormElementCheckBoxSelect and I'm receiving errors when I try to implement the below:

_IEFormElementCheckBoxSelect($oIE, 3, "", 1, "byIndex")

The error is "Error from function _IEFormElementCheckBoxSelect, $_IESTATUS_InvalidObjectType".

If someone could point me in the right direction, I would be very grateful.  Thanks

>>>> Window <<<<

Title: HEO Message - [Order Entry]

Class: WindowsForms10.Window.8.app9

Position: 0, 0

Size: 1456, 876

Style: 0x16C70000

ExStyle: 0x00010100

Handle: 0x00030948
>>>> Control <<<<

Class: Internet Explorer_Server

Instance: 1

ClassnameNN: Internet Explorer_Server1

Name: 

Advanced (Class): [CLASS:Internet Explorer_Server; INSTANCE:1]

ID: 

Text: 

Position: 0, 0

Size: 1441, 806

ControlClick Coords: 306, 246

Style: 0x56000000

ExStyle: 0x00000000

Handle: 0x00090C7A
>>>> Mouse <<<<

Position: 314, 276

Cursor ID: 2

Color: 0xFFFFCC
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<

Back

Home


>>>> Hidden Text <<<<

Print
 
Posted (edited)

Local $hWnd = WinWait("[CLASS:WindowsForms10.Window.8.app9]", "", 10)
Local $oIE = _IEAttach($hWnd, "embedded")
Local $oForm = _IEFormGetCollection($oIE, 0)
_IEFormElementCheckBoxSelect($oForm, 0, "", 1, "byIndex")

Might have just had a breakthrough.  I read up on using _IEFormGetCollection and now am able to fill a single checkbox.  Now I need to figure how how to loop through the entire form and fill all the checkboxes available.  Any pointers on how to go about filling all checkboxes on a form of unknown length?

Edited by blehbloo
Posted

Solved it!

Local $hWnd = WinWait("[CLASS:WindowsForms10.Window.8.app8]", "", 10)
Local $oIE = _IEAttach($hWnd, "embedded", 1)
Local $oForm = _IEFormGetCollection($oIE, 0)

$checker = 1
$i = 0

While $checker = 1
   If _IEFormElementCheckBoxSelect($oForm, $i, "", 1, "byIndex") Then
      $i = $i + 1
   Else
      MsgBox(0, "", "all boxes checked")
      $checker = 0
   EndIf
WEnd

That will loop iterate across the entire application, filling checkboxes as it goes.

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