Jump to content

Internet Explorer Automation UDF library


DaleHohm
 Share

Recommended Posts

is there a way to make this udf sign into login and password forms that are prompted? (like, when accessing an ftp area)

Also, is there a way to make it click the 'ok' on the popup dialog msgbox's? Because, i can control click them if there's 1, but sometimes i get 2, and when that happens, the control click only gets rid of one, and ignores the other...

[quote]If whenever you feel small, useless, offended, depressed, and just generally upset always remember......you were once the fastest and most vicious sperm out of hundreds of millions![/quote]

Link to comment
Share on other sites

@Mason

I don't think you should find that surprising. By default, _IENavigate will call _IELoadWait and will loop checking to see that the load is completed before passing control back to the next statement in your script. It errors because the object it is checking the status on has disappeared.

You can override the calling of _IELoadWait by setting the optional 3rd parameter to 0. See the function header for more:

; Function Name:    _IENavigate()
; Description:      Directs an existing browser window to navigate to the specified URL
; Parameter(s):     $o_object       - InternetExplorer.Application, Window or Frame object
;                   $s_Url          - url to navigate to (e.g. "http://www.autoitscript.com")
;                   $f_wait         - 1 = wait for page load to complete before returning
;                                   - 0 = return immediately

To have your cake and eat it too, set the $f_wait to 0 and then use _IEGetProperty($oIE, "readystate") to see if the readystate is 4 or "complete" before moving on (and you can test IsObj($oIE) before you check it each time).

Dale

It might be just me, but if you close the IE window before it successfully loads the url using _IENavigate then it will give you an error. Is this just me or is this a bug?

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

@Faleira

The bad news is that the DOM (Document Object Model) that IE.au3 interacts with does not seem to have any way of knowing or alerting us that these user input dialogs are active. The good news is that they are pretty standard windows dialogs that can be discovered and manipulated with standard AutoIt window management commands (as you have already discovered).

So, you need to be able to anticipate them and have AutoIt code in place to manage them (using ControlSend etc.). Regarding having more of them than expected... you may just need to check for more than one or you MIGHT want to look at AdLibEnable as a potential solution.

Dale

is there a way to make this udf sign into login and password forms that are prompted? (like, when accessing an ftp area)

Also, is there a way to make it click the 'ok' on the popup dialog msgbox's? Because, i can control click them if there's 1, but sometimes i get 2, and when that happens, the control click only gets rid of one, and ignores the other...

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

Hey, was wondering, i fi use the clicklink function, but there are multiple strings that match the one searched, does it click on the first one that it findsby index?

[quote]If whenever you feel small, useless, offended, depressed, and just generally upset always remember......you were once the fastest and most vicious sperm out of hundreds of millions![/quote]

Link to comment
Share on other sites

Please see the parameter descriptions in the function header (3rd parameter)

Func _IEClickLinkByText($o_object, $s_linkText, $i_index = 0, $f_wait = 1)
   ; _IE_clickLinkText( $o_object, $s_linkText [, $i_index][, $f_wait])
   ; $o_object - Object Valiable pointing to an InternetExplorer.Application object
   ; $s_linkText - linkText, the text displayed on the web page for the desired link to click
   ; [$i_index] - if the link text occurs more than once, specify which instance you want to click
   ;        note: instance numbering starts at 0

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

how do i pic a form that doesn't have a name? i making a script to change wireless access point settings

as far as i see the form has no name

<form onsubmit="return onsubmit();">

i am trying to toggle radio box from didabled to enabled

$oFrom = _IEFormGetObjByName($o_IE, "sForm")

$oUp = _IEFormElementGetObjByName($oFrom, "snmp_status", 0)

$oDown = _IEFormElementGetObjByName($oFrom, "snmp_status", 1)

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

Use _IEFormGetObjByIndex instead. It uses the 0-based form collection (i.e. the first form on the page is index 0, 2nd is 1, etc)

Dale

how do i pic a form that doesn't have a name? i making a script to change wireless access point settings

as far as i see the form has no name

i am trying to toggle radio box from didabled to enabled

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...thanks that fixed that problem

now it selects enabled like its supposed to but theres a onclick that enables the rest of the from thats not working

<div id="adm_status_true" style="disable=true">

<td align="left" width=50% class="nameleveltwo">

<input class=value type="radio" value="up"

name="snmp_status"

CHECKED

onclick="ChangeLayer(true)">Enable &nbsp; &nbsp; <input class=value type="radio" value="down"

name="snmp_status"

onclick="ChangeLayer(false)">Disable

</td>

it looks like i need to do the javascript ="ChangeLayer(true)"> from my script....or actually click it....so it enables the rest of the form

#######

edit

#######

i figured it out .clicked instead of .checked

$oFrom = _IEFormGetObjByIndex($o_IE, 0)

$o_Up = _IEFormElementGetObjByName($oFrom, "snmp_status", 0)

;$o_Up.checked = True

$o_Up.click

Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

ok...one last question (i hope)

the last part of the script needs to copy text from the webpage (copy the mac address of the router)

any idea how to get this text?

when i view the source of the cqi i see this for the mac address section

<tr>

<td class=namelevelone>

MAC Address

</td>

<td> &nbsp; </td>

<td class=value>

00:0B:33:12:64:40

</td>

</tr>

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

There are many choices on how to do this.

One is to use _IEAction( $oIE, "copy") which will copy the browser text into the clipboard... then use ClipGet to read and parse it.

Another is to use _IEBodyReadHTML() and get the body HTML into a string and then parse it for what you want.

If you acquaint yourself with the DOM, you can find a reference to the particular table cell and then use .innerText to get the value.

My preferred way is using the IE.au3 table functions to get a reference to the table and then use _IETableWriteToArray() to copy the contents of the HTML table into an AutoIt array. You then just need to figure out the array index of the data you are looking for.

Dale

ok...one last question (i hope)

the last part of the script needs to copy text from the webpage (copy the mac address of the router)

any idea how to get this text?

when i view the source of the cqi i see this for the mac address section

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

Man ur UDF is GREAT, butta i'm having a little trouble here.

how shouldi know what parameters to use with what command??

could you PLEASE update your help file in the first post like:

_IEFormGetObjByName(object, Formname)

or something like that?

because i really need to know how frames work.

the form i wanna use is in a frame so a normal call just doesn't help B)

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

Look at the function headers lower down in the file for specifics on the parameters taken by each function.

Look in reply 3 for examples with using frames. Also search the forum for _IEFrameGetObjByName for more examples and discussion.

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

sorry, but i really don't see a frame example in reply 3, but i'll look into the IE.au3 for the parameters.

btw what i ment is that instead of just stating:

_IEFrameGetObjByName()

*explaination*

do a:

_IEFrameGetObjByName(parameters)

*explanation

it would be allot of help.

thanks anyway B)

good luck

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

what to use to CLick on the submit button instead of using the fucntion, because if i use the function the website says thiss: Sorry, de zojuist opgegeven gebruikersnaam en/of wachtwoord ken ik niet.

in english: sorry you have given an incorrect username or password.

but i'm 100% there both correct.

and if i don't make it do the submit and click myself

it works

the site is http://intranet.a12.nl if you need to look at it

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

You are correct that there is not an example of frames in reply 3. I'll add one, but there certainly are quite a few if you search the for for _IEFrameGetObjByName as I suggested.

Edit: There is now a Frameset example in reply 3 with the caption: "Open a browser, navigate to a page with a Frameset, get a reference to the named frame 'contents' and click on a link in that frame."

There IS a Google example in reply 3 that shows you how to do a .click on a button to submit a form however.

Dale

what to use to CLick on the submit button instead of using the fucntion, because if i use the function the website says thiss: Sorry, de zojuist opgegeven gebruikersnaam en/of wachtwoord ken ik niet.

in english: sorry you have given an incorrect username or password.

but i'm 100% there both correct.

and if i don't make it do the submit and click myself

it works

the site is http://intranet.a12.nl if you need to look at it

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

I was making a simple script that went and disconnected a linksys router from the internet. But for some reason, even though i get the form object name, it gives an error saying that it's not an object...

$disconnect = _IEFormGetObjByIndex($Setup, 3)
$disconnect.click

[quote]If whenever you feel small, useless, offended, depressed, and just generally upset always remember......you were once the fastest and most vicious sperm out of hundreds of millions![/quote]

Link to comment
Share on other sites

You're clicking on the "form" -- you need to click on the submit button.

Reply 3 has an example of this.

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

but it's not realyl a submit button, it's an Input button, so it didn't work when i had it use _IEFormSubmit.

[quote]If whenever you feel small, useless, offended, depressed, and just generally upset always remember......you were once the fastest and most vicious sperm out of hundreds of millions![/quote]

Link to comment
Share on other sites

nvm... i'm an idiot, just a simple .click >.>

But i have another question right now... When you use the script that u gave in the earlier posts, that finds all the elements on a page, the img one doesn't find background images. Is it possible to change it so that it does?

[quote]If whenever you feel small, useless, offended, depressed, and just generally upset always remember......you were once the fastest and most vicious sperm out of hundreds of millions![/quote]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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