Jump to content

Internet Explorer Automation UDF library


DaleHohm
 Share

Recommended Posts

i have already open a browser and url is google.com

and i only want to automate enter a text that i want to search then click google search.

Hi julius,

What you want to use is _IEAttach instead of _IECreate -- it can link to an existing browser by specifying title, url and other criteria.

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

@Whaouu -- please PM me your current script and I'll modify it to put in some debugging code. We must be on the wrong track here. I don't really think that IE.au3 has a problem, but rather there is a logic problem or something unexpected is happening in the web page.

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

Hi,

Just wondering, is it possible to change this library so that it works with different IE shells, like Avant Browser? I've had a play around, but alot of you would know much better than I. Is it just a matter of finding the right COM name for the Avant Browser and switching the reference?

Any feedback would be greatly appriciated.

Ryan

Link to comment
Share on other sites

hi dale,

i have have problem on java script. how can i send a command to the java script fuintion so that the link that associated with this fuction will run.

here is the snapshot of the funtion

function openLink60(item_no)

{

if ( item_no==20) // update now

{

// ShowFrames("", "../cgi/cgiShowUpdate.exe?id=3121", false);

ShowFrames("", "updatenow-check.htm", false);

}

else if ( item_no==50 )

{

PopupClientOp(1, item_no, 560, 260, true, "cgiShowClientAdm.exe", false, false);

}

else if ( item_no==52)

}

}

and also how to call this funtion using your UDF file

thanks in advance.

julius

Edited by Julius Ramos

-----------------------------------------------------------BSECE, MCPAIM: juliusrmsYM: jivy_21@yahoo.comMSN: juliusLramos@hotmail.comMobile #: (Globe): +639167031989Web: http://www.trendmicro.com

Link to comment
Share on other sites

how if i use _IEClickLinkByText, how can i get the link of the text i click

There is nothing builtin that will return this when you click the link. It is an interesting idea however - I could use @extended to return interesting information like this in this and many other functions. I'll give it some thought.

In the mean time you'll need to parse through the links collection yourself and check the .innerHTML property to see if it matches your text and then the .href property to get the link. Check the source of the _IEClickLinkByText function for ideas.

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

Hi,

Just wondering, is it possible to change this library so that it works with different IE shells, like Avant Browser? I've had a play around, but alot of you would know much better than I. Is it just a matter of finding the right COM name for the Avant Browser and switching the reference?

Any feedback would be greatly appriciated.

Ryan

I'm sorry Ryan, I have no idea.

This would be a questions for the forums for Avant Browser or Maxathon or whatever. I did a quick search in the forums at Avant but their search results are very difficult to use.

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

hi dale,

i have have problem on java script. how can i send a command to the java script fuintion so that the link that associated with this fuction will run.

here is the snapshot of the funtion

function openLink60(item_no)

{

I have not tested this, but there is an execScript method on the window object. The syntax will be something like this:
$oIE.document.parentwindow.execScript("openLink60(" & item_no & ");", "javascript")

oh shoot, it is probably really like this:

Execute('$oIE.document.parentwindow.execScript("openLink60(' & $item_no & ');", "javascript"')

Also, if this function is tied to an onXXX event on an object, you can fire that event... there is an example of the .fireEvent method on the exxamples in reply 3.

Dale

Edit: typo, added .document to execScript example, added Execute

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

Hi julius,

What you want to use is _IEAttach instead of _IECreate -- it can link to an existing browser by specifying title, url and other criteria.

Dale

hi dale,

do you have any example of _IEAttach, i tried many times but it did run for me.

#include <IE.au3>
$oIE = _IECreate ()
_IENavigate ($oIE, "http://www.google.com.ph/")
$oIE2 = _IEAttach("Google - Microsoft Internet Explorer")

i try this simple one but it return 0

is there any wrong with my code.

thanks

julius

-----------------------------------------------------------BSECE, MCPAIM: juliusrmsYM: jivy_21@yahoo.comMSN: juliusLramos@hotmail.comMobile #: (Globe): +639167031989Web: http://www.trendmicro.com

Link to comment
Share on other sites

hi dale,

do you have any example of _IEAttach, i tried many times but it did run for me.

#include <IE.au3>
$oIE = _IECreate ()
_IENavigate ($oIE, "http://www.google.com.ph/")
$oIE2 = _IEAttach("Google - Microsoft Internet Explorer")
Nothing obvious wrong -- but since _IEAttach does a sub-string match you could try matching just "Google" in case there are any strange characters or spacing 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

i am getting an error... with #include <IE.au3>

First, you realize that this has nothing to do specifically with IE.au3 right?

AutoIt is having trouble physically opening the file. This could mean that it has become corrupt, there is some sort of lock on the resource or something funky is going on with system resources that is causing the trouble.

At the risk os sounding like Microsoft support, I'd suggest that you 1) logout and back in 2) reboot 3) refresh your copy of IE.au3.

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 there a way to choose a drop down option if the values are not declared?

<FORM action=/cgi-bin/gafx_info method=post>
<B>Delete after transmission? </B> <SELECT size=1 name=delete> 
<OPTION selected>YES</OPTION> <OPTION>NO</OPTION></SELECT>
</FORM>

how do i select the NO option.

I tried _IEFormElementSetValue() with values of "NO" and 2. Neither worked.

$o_AFX_delete = _IEFormElementGetObjByName ($o_AFXFileSendForm, "delete")
 _IEFormElementSetValue ($o_AFX_delete, "NO")

I was wondering if anybody has encountered this and found a workaround.

Link to comment
Share on other sites

is there a way to choose a drop down option if the values are not declared?

<FORM action=/cgi-bin/gafx_info method=post>
<B>Delete after transmission? </B> <SELECT size=1 name=delete> 
<OPTION selected>YES</OPTION> <OPTION>NO</OPTION></SELECT>
</FORM>

how do i select the NO option.

I tried _IEFormElementSetValue() with values of "NO" and 2. Neither worked.

$o_AFX_delete = _IEFormElementGetObjByName ($o_AFXFileSendForm, "delete")
 _IEFormElementSetValue ($o_AFX_delete, "NO")

I was wondering if anybody has encountered this and found a workaround.

Select...Options work is a similar way to CheckBoxes and RadioButtons -- see a discussion here. There is actually a .selected attribute you need to set on the object rather than trying to set its value. There is also an options collection that represents all of the current options.

So, assuming you want to set the second option (NO) then this should work:

$o_AFX_delete = _IEFormElementGetObjByName ($o_AFXFileSendForm, "delete")
$o_AFX_delete.options(1).selected = True

Dale

p.s. this is an area that IE.au3 could offer a series of convenience functions -- I know it is confusing

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

hi,

maybe it is a silly questions but....

where do you get these functions from?

object.document.title

object.document.body.innerText

object.document.body.innerHTML

object.LocationURL

object.navigate

is there a list of such functions?

MSDN is a wealth of knowledge once you learn how to navigate it.

Here is the starting point for the InternetExplorer object

Here is the starting point for the document object

You'll find objects, method and properties documented in detail.

Good luck,

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

Select...Options work is a similar way to CheckBoxes and RadioButtons -- see a discussion here. There is actually a .selected attribute you need to set on the object rather than trying to set its value. There is also an options collection that represents all of the current options.

So, assuming you want to set the second option (NO) then this should work:

CODE

$o_AFX_delete = _IEFormElementGetObjByName ($o_AFXFileSendForm, "delete")

$o_AFX_delete.options(1).selected = True

Dale

p.s. this is an area that IE.au3 could offer a series of convenience functions -- I know it is confusing

Thanks Dale works great.

I was using [] instead of ().

Is there a way to select an option based on its text instead of location? I have come to find out that the location of the options can change. So i need a safer way of selecting the correct option.

Link to comment
Share on other sites

TO ANSWER MY OWN QUESTION:

#include <IE.au3>

$o_IE = _IECreate ()

_IENavigate ($o_IE, "http://autos.msn.com")
_IELoadWait($o_IE)

$o_Form     = _IEFormGetObjByName ($o_IE, "LeftNavForm")
$o_make     = _IEFormElementGetObjByName ($o_Form, "mmMakes")


$length = _IEFormElementOptionGetCount($o_make)

For $i = 1 to $length
    $blah = $o_make.options($i).text
If  $blah = "Honda" Then
    $o_make.options($i).selected = True
    ExitLoop
Else
EndIf
Next
Link to comment
Share on other sites

Exactly. Good job.

Each option selection has both a coded-value and a display-value you see on screen. .options($i).value

gives you the coded value and .options($i).text the text displayed in the drop-down (you may find these values are sometimes identical, but don't let it fool you into thinking that they always are).

Dale

TO ANSWER MY OWN QUESTION:

#include <IE.au3>

$o_IE = _IECreate ()

_IENavigate ($o_IE, "http://autos.msn.com")
_IELoadWait($o_IE)

$o_Form     = _IEFormGetObjByName ($o_IE, "LeftNavForm")
$o_make     = _IEFormElementGetObjByName ($o_Form, "mmMakes")
$length = _IEFormElementOptionGetCount($o_make)

For $i = 1 to $length
    $blah = $o_make.options($i).text
If  $blah = "Honda" Then
    $o_make.options($i).selected = True
    ExitLoop
Else
EndIf
Next

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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