Jump to content

Ie.au3 T2.0 Internet Explorer Automation Library


DaleHohm
 Share

Recommended Posts

I'm particularly interested in getting some testing done with the functions:

  • _IEFormElementOptionselect()
  • _IEFormElementCheckboxSelect()
  • _IEFormElementRadioSelect()
They are complicated perhaps, but powerful and hopefully make form element manipulation much more logical than the T1 version. There are some pretty good examples in the .doc file (and soon to be in the help file).

Thanks in advance,

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • Replies 252
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I have a quick question and sorry if this is the wrong place but it is related to this ie lib I think.

I dont want to click on links but id there a com object to tell when a link is clicked on so I can use it in a guigetmsg and select statement?

I dont see anything like that in here but I thought I would ask.

Link to comment
Share on other sites

I dont want to click on links but id there a com object to tell when a link is clicked on so I can use it in a guigetmsg and select statement?

Sorry, that is gibberish to me... can you try again? If I'm following you at all you may want to look at ObjEvent.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

ok I'll try again.

I'm using this udf to diaply content for an app I'm working on. I'm using sqlite to store data and since the data sets are sometimes quite large this is the only thing i have found to display the data. It works quite well for it by the way. I have loaded an 18+ meg file into it.

At any rate I wanted to sue some css on the pages as well as possibly some navigation but since the data is loaded as a sting and then I use _IEDocWriteHTML to load the data into the com object?

I was thinking it would be nice to use actuall html links and somehow capture the clicks on those links and then use it to generate quireies to grab the next chapter or book or whatever from sqlite?

So far I dont see that here I see only the other way around were you an use it to click on links but not capture the data of when and what link is clicked on.

html links would look very nice in this app.

Link to comment
Share on other sites

ok I'll try again.

I'm using this udf to diaply content for an app I'm working on. I'm using sqlite to store data and since the data sets are sometimes quite large this is the only thing i have found to display the data. It works quite well for it by the way. I have loaded an 18+ meg file into it.

At any rate I wanted to sue some css on the pages as well as possibly some navigation but since the data is loaded as a sting and then I use _IEDocWriteHTML to load the data into the com object?

I was thinking it would be nice to use actuall html links and somehow capture the clicks on those links and then use it to generate quireies to grab the next chapter or book or whatever from sqlite?

So far I dont see that here I see only the other way around were you an use it to click on links but not capture the data of when and what link is clicked on.

html links would look very nice in this app.

Your question is still not very clear to me, but I'll give you some food for thought.

When you use _IEDocWriteHTML, when the function completes IE will parse the HTML and display it just as if it had been a page that was navigated to (there are some cases I've seen, like writing frames, that a refresh must be performed - _IEAction($oIE, "refresh")) -- so you can freely use hyperlinks or any HTML.

So, it appears that your question is really how can your application intercept a click event and then take action based upon that event? You're right, this is not functionality in IE.au3 today (I need to balance simplicity with functionality... there is so much that CAN be done I had to draw a line). You can do it with AutoIt in combination with IE.au3 however.

To capture the event of an object being clicked, you need to use the AutoIt ObjEvent function. There are not a lot of examples of this in the forum, but a search will net you a few (you'll actully find quite a few matches for error handlers, but few for actual event processing).

I'd suggest that you use <BUTTON> element instead of a link (<a href=>) because you are not actually wanting the browser to take action for you after a click, but rather you want to trap and process it.

If your HTML contains the following:

<button id=myButton value=NextChapter>

You could have AutoIt code like the following:

$oMyButton = _IEGetObjByName($oIE, "myButton")
$oEvtMyButton = ($oMyButton, "IEEvent_")

; do some stuff

Func IEEvent_onclick()
    ; take your actions based on the button click in here
EndFunc

Dale

Edit: typos

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

thanks for that it ws exactly what I wsa looking for.

I have for now a webserver that is written in autoit by another forum memeber that I modified to parse templates and pull data from the sql database.

I have it parse the url's then extract the data from the cutom url's and then run the quiry and display that data back in the ieCreateEmbedded object.

This works great also.

Thank you for your reply. I will look into it as running a webserver to parse sql reqests was not my original intention. There is an added benefit though in that with documentwrite the forward and back buttons do not work but by using this method they do. It's kind of like built in query caching.

Link to comment
Share on other sites

Thank you very much... THis is exactly what i was looking for. I coded a full bot.

Just had one issue

when there is more than more submit button it cant use the submit function, anyway to call the button by name?

Use _IEFormElementGetObjByName and then _IEAction with a click parameter.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

any way this will work with out a form name?

Every element on the page has an index regardless of whether it has a name or ID. Indexes are assigned in the order that the elements appear on the page and within collections. There is a collection of all elements (you get this with _IETagNameAllGetCollection), of forms (you get this with _IEFormGetCollection), formelements, tables, etc.

Each of these functions you are using has a *GetObjByName and a *GetCollection form. The *GetCollection returns a collection by default (this is like a one-dimensional array of elements and can be looped through with the special For...In...Next looping construct). If you specify an index value of 0 or greater (-1 is the default and returns the collection) then you will get a reference to the element by its index value.

Please take a look at the IE.au3 helpfile (see basenote) for more information and examples.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Every element on the page has an index regardless of whether it has a name or ID. Indexes are assigned in the order that the elements appear on the page and within collections. There is a collection of all elements (you get this with _IETagNameAllGetCollection), of forms (you get this with _IEFormGetCollection), formelements, tables, etc.

Each of these functions you are using has a *GetObjByName and a *GetCollection form. The *GetCollection returns a collection by default (this is like a one-dimensional array of elements and can be looped through with the special For...In...Next looping construct). If you specify an index value of 0 or greater (-1 is the default and returns the collection) then you will get a reference to the element by its index value.

Please take a look at the IE.au3 helpfile (see basenote) for more information and examples.

Dale

nvm found out i could just use JS.

_IENavigate($oIE, "java script: document.bulletinForm.action='http://bulletin.myspace.com/index.cfm?fuseaction=bulletin.update';document.bulletinForm.submit();")

Edited by blizzedout
Link to comment
Share on other sites

nvm found out i could just use JS.

_IENavigate($oIE, "java script: document.bulletinForm.action='http://bulletin.myspace.com/index.cfm?fuseaction=bulletin.update';document.bulletinForm.submit();")

ok.

pIease create posts like this in the V3Suppot Forum from now on. This post is too long to work point issues.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Can someone show me exampel code of how to make a script that will autolog me into gmail?

here is how i kind of see it:

#include<IE.au3>


func login($username, $password, $silent)
$oIE = _IECreate ("https://gmail.com", 0, 0)  
; get pointers to the login form and username and password fields
$o_form = _IEFormGetCollection ($oIE, "????? how do i get this?")
$o_name = _IEFormElementGetObjByName ($o_form, "Email")
$o_pass = _IEFormElementGetObjByName ($o_form, "Passwd")

If @error = 1 Then
    if $silent = 1 then MsgBox(0, "Error","No connection")
    return 0
EndIf

; Set field values and submit the form
_IEFormElementSetValue ($o_name, $username)
_IEFormElementSetValue ($o_pass,  $password)
_IEFormSubmit ($o_form)

endfunc

Problem I have is this:

$o_form = _IEFormGetCollection ($oIE, "????? how do i get this?")

Also i'm not sure what the use of silent is for? I noticed in other code examples it's used a lot?

I don't understand what this code does can someone explain it to me?:

While $i = 1
    If WinExists("Email was sent - Microsoft Internet Explorer") Then
        $i = 0
        ExitLoop
    EndIf
    If WinExists("http://www.fake-mailer.com/fmlite/sendMail.php") Then
        WinKill("http://www.fake-mailer.com/fmlite/sendMail.php")
        If $silent = 1 Then MsgBox(16, "Email Sender", "Error Sending Email")
        $i = 0
        Exit
    EndIf
WEnd
If $silent = 1 Then MsgBox(64, "Email Sender", "Email Was Sent")
WinKill("Email was sent - Microsoft Internet Explorer")
Edited by Falling
Link to comment
Share on other sites

Hey what do you do if you use this software but when you log into a site it ask to accept a certificate?

Is there an easy way around that?

If you can anticipate being prompted for one, you can use the standard AutoIt window functions to interact with it (WinWait, WinActivate, ControlSend etc.).

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

If you can anticipate being prompted for one, you can use the standard AutoIt window functions to interact with it (WinWait, WinActivate, ControlSend etc.).

Dale

Is there optional parametors in Autoit? If so could i just change the way _IECreate() works?

Like add a optional parametor at the end... True or blank.

If True then expect a cirtificate and do the proper actions.

Most of the time certificates only come about when you first enter a site which is _IECreate() is for? So would it be best to keep that functionality all in one place?

Where can i find help files for stuff like _IECreate()? I press F1 above the word but it cannot find it.

Link to comment
Share on other sites

IE.au3 is now part of the standard UDF library as of beta 129 (3.1.1.129)!!

T2.0-5 or higher of the Internet Explorer Automation Library (and documentation in the standard helpfile) will be installed when you install the latest beta. From this point forward, betas with new fixes or functionality will be made available in the forum for testing, but the primary release mechanism will be through the standard AutoIt distribution.

See the basenote for minor fixes included in T2.0-5

Thanks to big_daddy for his work on formatting and adding to the documentation. Thanks for JdeB and JPM for getting it into the release.

I'd also like to thank Larry and Valik again for code contributions they made to this release.

Enjoy!

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Is this the right way to add certificate authentification?

I changed IECreate just so i can pass $certificate to IEnavigate.

Func _IECreate($s_Url = "about:blank", $f_tryAttach = 0, $f_visible = 1, $f_wait = 1, $f_takeFocus = 1, $certificate = false)

I changed IEnavigate to this:

All i did was add $certificate = False and a loop counter like this:

$onepass = true
    If ($certificate) AND $onepass Then
        sleep(2000) 
    
        If WinExists("Security Alert") Then 
            Send("{TAB}")
            Send("{TAB}")
            Send("{ENTER}")     
        EndIf
        $onepass = False
    EndIf

Func _IENavigate(ByRef $o_object, $s_Url, $f_wait = 1, $certificate = False)
    If Not IsObj($o_object) Then
        __IEErrorNotify("Error", "_IENavigate", "$_IEStatus_InvalidDataType")
        SetError($_IEStatus_InvalidDataType, 1)
        Return 0
    EndIf
;
    If Not __IEIsObjType($o_object, "documentContainer") Then
        __IEErrorNotify("Error", "_IENavigate", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
;
    If __IEIsObjType($o_object, "browser") Then
        Do
            Sleep(100)
        Until ($o_object.readyState = "complete" Or $o_object.readyState = 4)
    EndIf
;
    $o_object.navigate ($s_Url)
    $onepass = true
    If ($certificate) AND $onepass Then
        sleep(2000) 
    
        If WinExists("Security Alert") Then 
            Send("{TAB}")
            Send("{TAB}")
            Send("{ENTER}")     
        EndIf
        $onepass = False
    EndIf   
    
    
    If $f_wait Then
        _IELoadWait($o_object)
        SetError(@error)
        Return -1
    EndIf
    SetError($_IEStatus_Success)
    Return -1
EndFunc  ;==>_IENavigate

Then I make the call like this:

_IECreate ("URL HERE",0 , 1, 1, 1,True)

Is this a good method for this ? What should I have done differntly? Thanks for any information!

Link to comment
Share on other sites

No, I wouldn't do that.

You can get what you want pretty easily using Adlib. Something like this:

AdlibEnable("clickCertificate")
$oIE = _IECreate("URL HERE")
AdlibDisable()

Func clickCertificate()
    ;;; Your code to click OK on the Security Alert window
EndFunc

One complication would be if the Security popup causes the execution to pause waiting for the load to complete. If it does you'll need to set $f_wait to 0 in _IECreate and make certain youwait long enough after calling _IECreate before you turn off Adlib.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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