MattHiggs

IE UDF HELP!!!!

6 posts in this topic

Hey everyone.  So specifically, I am having an issue with the IE objects: maybe I'm not understand the whole object thing yet, so you will have to forgive me.  Here is the code I have so far:

include <IE.au3>
#include <Constants.au3>

#Region --- IE-Builder generated code Start ---
$sUrl = "www.ninite.com"
$oIE = _IECreate($sUrl, 1)
Local $array[12]
$oForms1 = _IEFormGetCollection($oIE, 78)
;$oEle = _IEFormElementGetCollection ( $oForms1, -1 )
#cs
$array[0] = _IEFormElementGetObjByName ( $oForms1, "apps", 1 )
$array[1] = _IEFormElementGetObjByName ( $oForms1, "apps", 3 )
$array[2] = _IEFormElementGetObjByName ( $oForms1, "apps", 23 )
$array[3] = _IEFormElementGetObjByName ( $oForms1, "apps", 24 )
$array[4] = _IEFormElementGetObjByName ( $oForms1, "apps", 25 )
$array[5] = _IEFormElementGetObjByName ( $oForms1, "apps", 26 )
$array[6] = _IEFormElementGetObjByName ( $oForms1, "apps", 27 )
$array[7] = _IEFormElementGetObjByName ( $oForms1, "apps", 34 )
$array[8] = _IEFormElementGetObjByName ( $oForms1, "apps", 40 )
$array[9] = _IEFormElementGetObjByName ( $oForms1, "apps", 76 )
$array[10] = _IEFormElementGetObjByName ( $oForms1, "apps", 81 )
$array[11] = _IEFormElementGetObjByName ( $oForms1, "apps", 83 )
#ce
_IEFormElementCheckBoxSelect ( $oForms1, 1, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 3, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 23, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 24, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 25, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 26, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 27, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 34, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 40, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 76, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 81, "apps", 1, "byIndex" )
_IEFormElementCheckBoxSelect ( $oForms1, 83, "apps", 1, "byIndex" )


#EndRegion --- IE-Builder generated code End ---

Here is the thing, I am using the IEbuilder tool from the download section (admittedly very useful for projects like this), and I have a pretty good understanding of HTML as well.  I have specified the form to be referenced by its index number, as well as the elements to check within the form, but nothing works.  I get to the site, but no buttons get checked.  I have last my patience with IE UDF.  I have never successfully gotten it to work the few times I have tried to use it and I am done.  Unless someone can show me what I am doing wrong.

Share this post


Link to post
Share on other sites



Quote

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "Z:\TOOLs\Macro\FORUM\___FORUM -- z forum\test_182629-ie-udf-help.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch
--> IE.au3 T3.0-2 Warning from function _IEFormGetCollection, $_IESTATUS_NoMatch
--> IE.au3 T3.0-2 Error from function _IEFormElementCheckBoxSelect, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementCheckBoxSelect, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementCheckBoxSelect, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementCheckBoxSelect, $_IESTATUS_InvalidDataType
..................
..................
..................

Do you want simply select all checkbox ?

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites
27 minutes ago, mLipok said:

Do you want simply select all checkbox ?

 

No.  There are specific boxes that I want to check.  Lets go back to the no match portion.  How is that?  I used the index of the form as displayed in the IEBuild tool, so it should have captured that form object.  Any idea why it is not reading a match?

Share this post


Link to post
Share on other sites

Are you sure there is 78 forms in that website ? You need to test and understand the IE UDF examples. You can do like this:

include <IE.au3>

Local $oIE = _IECreate("www.ninite.com")
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

Sleep(5000) ; just to make sure

Local $oForm = _IEFormGetCollection($oIE, 0)
If Not IsObj($oForm) Then Exit ConsoleWrite("Error in $oForm" & @CRLF)

_IEFormElementCheckBoxSelect($oForm, "teamviewer11", "cb_bd6x4")
_IEFormElementCheckBoxSelect($oForm, "7zip", "cb_bcaaf")

Exit

Or

include <IE.au3>

Local $oIE = _IECreate("www.ninite.com")
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

Sleep(5000) ; just to make sure

Local $oTeamViewer11 = _IEGetObjById($oIE, "cb_bd6x4")
If Not IsObj($oTeamViewer11) Then Exit ConsoleWrite("Error in $oTeamViewer11" & @CRLF)

Local $o7Zip = _IEGetObjById($oIE, "cb_bcaaf")
If Not IsObj($o7Zip) Then Exit ConsoleWrite("Error in $o7Zip" & @CRLF)

; you can click

$oTeamViewer11.click()
$o7Zip.click()

; or you can use checked

$oTeamViewer11.checked = True
$o7Zip.checked = True

Exit

 

Share this post


Link to post
Share on other sites

Thank you for the example.  Yes I do have much to learn about com objects, but believe it or not, there is only one form on the ninite website and was able to determine (with powershell) that its name is "null", so it would seem the author of the website wanted to specifically try to prevent what I am doing lol.

Share this post


Link to post
Share on other sites

The form in that website has no name or id, but i dont think that it was designed to prevent automation (as you can grab that element with other method). Glad that the example helped. :)

The IE UDF is well documented and has a very good examples.

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