Jump to content

Internet Explorer Automation UDF library


DaleHohm
 Share

Recommended Posts

I'm happy to announce that the next release of IE.au3 has been released (with documentation!)

See Here

The version in this thread will remain available until the new release has proven stable.

Dale

===============================================================

This basenote will hold the most recent version of an Internet Explorer Automation UDF Library (scroll to the bottom of this base-note post to find the link to IE.au3). All constructive feedback welcome.

See Post 3 in this thread for a growing list of examples.

Thanks,

Dale

Edit 7/9/05: Here is version T1.1 (See Update History for changes)

Edit 7/11/05: Here is version T1.2 (See Update History for changes)

Edit 7/14/05: Here is version T1.3 (See Update History for changes)

Edit 7/24/05: Here is version T1.4 (See Update History for changes)

Important: AutoIt Beta 3.1.1.63 or higher is now required to the use of the ObjName function. Beta downloads are here

Also Important: Download a current version of SciTe (and use the Beta definitions) to get rid of the ObjName error from Au3Check

CODE
    Title:   Internet Explorer Automation UDF Library for AutoIt3

    Filename:  IE.au3

    Description: A collection of functions for creating, attaching to, reading from and manipulating Internet Explorer

    Author:   DaleHohm

    Version:  T1.4

    Last Update: 7/24/05

    Requirements: AutoIt3 Beta with COM support (3.1.1.63 or higher), Developed/Tested on WindowsXP Pro with Internet Explorer

    Notes:

    Errors associated with incorrect objects will be common user errors.

    AutoIt beta 3.1.1.63 has now added an ObjName() function that will be used

    to trap and report most of these errors. 

    This version of IE.au3 makes minimal use of this function but future release

    will be enhanced to take full advantage of it.

   

    Update History:

    ===================================================

    T1.0 7/9/05

    Initial Release - error handling is pretty basic, documentation has just begun, only initial UDF standards met

    ---------------------------------------------------

    T1.1 7/9/05

    Fixed errors with _IEQuit, _IETableGetCount and _IETableGetCollection

    Added _IETableWriteToArray

    ---------------------------------------------------

    T1.2 7/11/05

    Added description text to all functions (full parameter documentation still pending)

    Removed 4 _IEAttachByXXXX functions and replaced with one _IEAttach function with a mode parameter

    Removed _IEForward() and _IEBack() and put functionality into the _IEAction() function

    Added _IEAction() that performs many simple browser functions

    Added _IEPropertyGet() that retrieves many properties of the browser

    ---------------------------------------------------

    T1.3 7/14/05

    Change _IEPropertyGet() to _IEGetProperty() (sorry, should have been that way from the beginning)

    Added _IEClickImg() that allows finding and clicking on an image by alt text, name or src

    Added _IETagNameAllGetCollection() to get a collection of all elements in the document

    Added _IETagNameGetCollection() to get a collection of all elements in a document with a specified tagname

    ---------------------------------------------------

    T1.4 7/24/05

    Fixed bug in _IEClickImg() that only allowed exact matches instead of sub-string matches

    Enhanced _IELoadWait() to work with Frame and Window objects (by drilling document readyState)

    Enhanced _IELoadWait() to add a configurable delay before checking status (to allow previous actions to start execution) - default = 0 milliseconds

    Added _IEBodyReadHTML() and _IEBodyWriteHTML() functions (read the page HTML, modify it and put it back!)

    Fixed _IEAttach() so that certain shell variants did not cause failures (using new ObjName() function in beta 3.1.1.63 -- thanks Sven!)

    ===================================================

   

    \\\ Core Functions

   

    _IECreate()

    Create an Internet Explorer Browser Window

   

    _IENavigate()

    Directs an existing browser window to navigate to the specified URL

   

    _IEAttach()

    Attach to the first existing instance of Internet Explorer where the search string sub-string matches

    based on the mode selected.

   

    _IEDocumentGetObj()

    Given a Window object, returns an object associated with the embedded document

   

   

    \\\ Frame Functions

   

    _IEIsFrameSet()

    Chects to see if the specified Window contains a FrameSet

   

    _IEFrameGetCount()

    Find the number of Frames (standard or iFrame) in the specified document

   

    _IEFrameGetCollection()

    Get a collection object containing the frames in a FrameSet or the iFrames on a normal page

   

    _IEFrameGetObjByIndex()

    Returns an object reference to a window within the specified frame (note that frame collection is 0 based)

    This object can be used in the same manner as the InternetExplorer.Application object

   

    _IEFrameGetObjByName()

    Obtain an object reference to a frame by name

   

    _IEFrameGetNameByIndex()

    Obtain an object reference to a frame by 0-based index

   

    _IEFrameGetSrcByIndex()

    Obtain the URL references within a frame by 0-based index

   

    _IEFrameGetSrcByName()

    Obtain the URL references within a frame by name

   

   

    \\\ Link Functions

   

    _IEClickLinkByText()

    Simulate a mouse click on a link with text sub-string matching the string provided

   

    _IEClickLinkByIndex()

    Simulate a mouse click on a link by 0-based index (in source order)

   

   

    \\\ Image Functions

   

    _IEClickImg()

    Simulate a mouse click on an image.  Match by sub-string match of alt text, name or src

   

   

    \\\ Form Functions

   

    _IEFormGetCount()

    Get the count of the number of forms in the document

   

    _IEFormGetCollection()

    Obtain a collection object variable representing the frames in the document

   

    _IEFormGetObjByIndex()

    Obtain an object variable reference to a form by 0-based index

   

    _IEFormGetObjByName()

    Obtain an object variable reference to a form by name

   

    _IEFormGetNameByIndex()

    Obtain the name of a form by its 0-based index

   

    _IEFormElementGetCount()

    Obtain a count of the number of form elements within a given form

   

    _IEFormElementGetCollection()

    Obtain a collection object variable of all form elements within a given form

   

    _IEFormElementGetObjByIndex()

    Obtain a object reference to a form element within a form by 0-based index

   

    _IEFormElementGetObjByName()

    Obtain a object reference to a form element within a form by name

   

    _IEFormElementGetTypeByIndex()

    Obtain the type of a givien form element within a form by 0-based index

    (button, checkbox, fileUpload, hidden, image, password, radio, reset, submit, or text)

   

    _IEFormElementOptionGetCount()

    Get count of Options within a Select drop-down form element

   

    _IEFormElementGetValue()

    Get the value of a specifid form element

   

    _IEFormElementSetValue()

    Set the value of a specified form element

   

    _IEFormSubmit()

    Submit a specified form

   

    _IEFormReset()

    Reset a specified form

   

   

    \\\ Table Functions

   

    _IETableGetCount()

    Get count of tables within a document

   

    _IETableGetCollection()

    Obtain a collection object variable representing all the tables in a document

   

    _IETableGetObjByIndex()

    Obtain an object reference to a table in a document by 0-based index

   

    _IETableWriteToArray()

    Reads the contents of a table into an array.

    Note: Currently, if any of the cells span more than one column, the column offsets will be incorrect

    \\\ Body functions

    _IEBodyReadHTML()

    Retrieves the HTML inside the <body> tag of the document

    _IEBodyWriteHTML()

    Replaces the HTML inside the <body> tag of the document

    \\\ Utility Functions

    _IETagNameGetCollection()

    Returns a collection object all elements in the object with the specified tagName.

    The DOM is hierarchical, so if the object passed is the document object, all elements

    in the docuemtn are returned.  If the object passed in is an object inside the document (e.g.

    a TABLE object), then only the elements inside that object are returned.

   

    _IETagNameAllGetCollection()

    Returns a collection object all elements in the document in source order.

   

    _IELoadWait()

    Wait for a browser page load to complete before returning

   

    _IEAction()

    Perform any of a set of simple actions on the Browser

   

    _IEGetProperty()

    Retrieve a select property of the Browser

   

    _IEQuit()

    Close the browser and remove the object refernce to it

IE.au3

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'm still toying a bit with the architecture of it -- there are so many things that CAN be done that I've got to find the right balance between simplicity and completeness.

I'm also struggling with whether to create a very large number of atomic functions or whether to overload some of them so that they perform different but similar tasks based on parmeters passed (e.g. should we have _IEAttachByTitle, _IEAttachByURL, _IEAttachByText and _IEAttachByHTML as individual functions or a single _IEAttach function with 4 different modes and a parameter to select them).

These have not yet gotten extensive testing and several of the functions were written in faith from the MSDN documentation and have not been tested at all yet.

I'll keep this basenote up to date with the current version. If others want to help, perhaps we can move some of the work over to the Wiki.

Many thanks to Sven for adding the COM support and his support of this forum. Also to ScriptKitty for his excellent examples over the past many weeks -- much of that code is pinched for these UDFs (and I hope he and others will lend their energy and creativity to this effort).

This is my first attempt at a formal UDF, so I welcome reviews and constructive criticism from the many of you who are pros at it.

Thanks,

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

This reply will contain examples of usage of the UDF library...

Click to a search page, enter criteria and submit.

#cs
   This sample code will:
   1) Create a new browser window
   2) Navigate to http://www.autoitscript.com
   3) click on the 'forum' link
   4) click on the 'Search' link
   5) get the object reference for the form named 'sForm'
   6) get the object reference for the form field 'keywords' in the form 'sForm'
   7) enter the value 'ReadyState' into the 'keywords' field
   8) submit the form to return the search results
#ce

#include <IE.au3>

$o_IE = _IECreate ()
_IENavigate ($o_IE, "http://autoitscript.com")
_IEClickLinkByText ($o_IE, "forum")
_IEClickLinkByText ($o_IE, "Forums")
_IEClickLinkByText ($o_IE, "Search")
$o_SearchForm = _IEFormGetObjByName ($o_IE, "sForm")
$o_Keywords = _IEFormElementGetObjByName ($o_SearchForm, "keywords")
_IEFormElementSetValue ($o_Keywords, "ReadyState")
_IEFormSubmit ($o_SearchForm)

Log into Hotmail

#include <IE.au3>
.fo
; Create a browser window and navigate to hotmail
$oIE = _IECreate()
_IENavigate($oIE, "http://www.hotmail.com")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "f1")
$o_login = _IEFormElementGetObjByName($o_form, "login")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "your username here")
_IEFormElementSetValue($o_password, "your password here")
_IEFormSubmit($o_form)

Exit

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.

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.cs.princeton.edu/~kguinee/thesis.html")
; View Source on this page reveals 3 frames named top, contents and main

$oFrame = _IEFrameGetObjByName($oIE, "contents"); get a reference to the contents frame
_IEClickLinkByText($oFrame, "The Telephone"); click on a link in the contents frame

Navigate to the AutoIt v3 Support forum and enter a new post (uses _IEClickImg())

#include <IE.au3>

; Create a new browser window and navigate to a page
$oIE = _IECreate()
_IENavigate($oIE, "http://autoitscript.com")

; Click on liks to navigate to the v3 Support forum
_IEClickLinkByText($oIE, "forum")
_IEClickLinkByText($oIE, "v3 Support")

; Click on the NewTopic button
_IEClickImg($oIE, "Start new topic", "alt")

; Find the form and the form fields we are interested in
$o_form     = _IEFormGetObjByName($oIE, "REPLIER")
$o_title     = _IEFormElementGetObjByName($o_form, "TopicTitle")
$o_desc     = _IEFormElementGetObjByName($o_form, "TopicDesc")
$o_message     = _IEFormElementGetObjByName($o_form, "Post")

; Set the value of the form fields
_IEFormElementSetValue($o_title, "Test using the IE Automation UDF Library")
_IEFormElementSetValue($o_desc, "I'm a knucklehead...")
_IEFormElementSetValue($o_message, "I didn't mean to Submit this!")

; The next line would submit the form -- but don't do it unless you want to be a knucklehead :-)
;;;;_IEFormSubmit($o_form)

Exit

This example demonstrates how to use the fireEvent() method to trigger an event associated with an object. In this case, dhtmlcentral uses a Javascript menu for navigation of the site. When you "mouseOver" one of the top level menu items (each defined in a <div> tag), a submenu drops down. This script performs a virtual "mouseOver" on each of the top level menu items, then clicks on one of the submenu items.

#include <IE.au3>

$oIE = _IECreate(); Create a new browser window
_IENavigate($oIE, "http://www.dhtmlcentral.com")

$divs = _IETagNameGetCollection ($oIE.document, "div")

$divs.item("oM_m1").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m2").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m3").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m4").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m5").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m6").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m7").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m1").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m9").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m9").click

This example opens the AutoIt forum search page and toggles the sortby radiobuttons. An identical technique can be used with checkboxes.

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.autoitscript.com/forum/index.php?act=Search&f=")

$oFrom = _IEFormGetObjByName($oIE, "sForm")
$oRelevant = _IEFormElementGetObjByName($oFrom, "sortby", 0)
$oRecent = _IEFormElementGetObjByName($oFrom, "sortby", 1)

For $i = 1 to 5
    $oRelevant.checked = True
    Sleep(1000)
    $oRecent.checked = True
    Sleep(1000)
Next

This example creates a browser window, navigates to Google, sets the search string value and performs a search.

By looking at the HTML source on the Google page, you'll find that the form on the page has a name of "f" and the query text box has a name of "q" (this will of course be different on differnt web pages, so you need to look at the source). These names are used to create references to the form and the field in the form so that we can act upon them.

The _IELoadWait at the end is optional and causes the script to wait for the page to be fully loaded before moving to the next line. Many of the IE.au3 functions can perform this wait automatically, but the _IEFormSubmit cannot.

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")

$oForm = _IEFormGetObjByName($oIE, "f")
$oQuery = _IEFormElementGetObjByName($oForm, "q")

_IEFormElementSetValue($oQuery, "place your search string here")
_IEFormSubmit($oForm)
_IELoadWait($oIE)

Exit

Here is the same Google example, but this submits the form by performing a .click event on the "Google Search" button instead of usng the _IEFormSubmit function:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")

$oForm = _IEFormGetObjByName($oIE, "f")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
$oButton = _IEFormElementGetObjByName($oForm, "btnG")

_IEFormElementSetValue($oQuery, "place your search string here")
$oButton.click
_IELoadWait($oIE)

Exit

Here is the same Google example, but this submits the form by giving focus to the "Google Search" button and sending an "Enter" from the keyboard instead of usng the _IEFormSubmit function. Thanks for this go to AutoItPimp who discovered the need for this and found the work-around because the button that he was clicking put up a modal dialog box that would not yield control back to AutoIt until it had been manually dismissed. This allowed him to click the button and give control back in his script so that he could use AutoIt to manipulate the dialog box even though processing in the webpage was suspended. Note: This technique can also be used to fill <input type="file"> fields in a form -- IE prevents scripting of these fields for security reasons.

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")

$oForm = _IEFormGetObjByName($oIE, "f")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
$oButton = _IEFormElementGetObjByName($oForm, "btnG")

_IEFormElementSetValue($oQuery, "place your search string here")
$oButton.focus()
Send("{Enter}")
_IELoadWait($oIE)

Exit

Use _IETableWriteToArray to read the contents of an HTML table into an array.

#include <IE.au3>; Include the UDF

; Create an IE Browser
;
$oIE = _IECreate()

; Navigate to your URL
;
_IENavigate($oIE, "http://pda.hko.gov.hk/wxreporte.htm")

; Get a reference to the Second table on the webpage (where the detail is stored)
;     note that object indexes are 0-based, so the second table is index 1
;
$oTable2 = _IETableGetObjByIndex($oIE, 1)

; Read the table cells into a 2-D array
;
$aWeather = _IETableWriteToArray($oTable2)

; Write the array contents out to the console
;
For $i = 0 to Ubound($aWeather, 2) - 1
    ConsoleWrite("City: " & $aWeather[0][$i] & " --> Temp: " & $aWeather[1][$i] & @CR)
Next

Exit

------------------------------------------------------------
It creates output like this:

City: KING'S PARK --> Temp: 28 DEGREES;
City: WONG CHUK HANG --> Temp: 29 DEGREES;
City: TA KWU LING --> Temp: 29 DEGREES;
City: LAU FAU SHAN --> Temp: 28 DEGREES;
City: TAI PO --> Temp: 29 DEGREES;
City: SHA TIN --> Temp: 29 DEGREES;
City: TUEN MUN --> Temp: 29 DEGREES;
City: TSEUNG KWAN O --> Temp: 28 DEGREES;
City: SAI KUNG --> Temp: 29 DEGREES;
City: CHEUNG CHAU --> Temp: 28 DEGREES;
City: CHEK LAP KOK --> Temp: 30 DEGREES;
City: TSING YI --> Temp: 29 DEGREES;
City: SHEK KONG --> Temp: 29 DEGREES .

Read the contents of the body of a webpage and search for a string. If the string is found, replace it with a new string and write it back to the webpage.

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.autoitscript.com/")

$body = _IEBodyReadHTML($oIE)

If StringInStr($body, "automation") Then
    MsgBox(0, "Success", "The string was found")
    $newbody = StringReplace($body, "automation", "AUTOMATION - Yeah!")
    _IEBodyWriteHTML($oIE, $newbody)
Else
    MsgBox(0, "Fail", "The string was NOT found")
EndIf

Exit

This example demonstrates how to set a form element value for a Select, Option field and then fire the onchange event that triggers a Javascript. Here's source from a webpage that demonstrates this:

<select name="Region" size="10" onchange="PopulateSecondPane(this.form, this.form.Region.options[this.form.Region.selectedIndex].value);" ID="Select1">

The values in a second Select, Option field change based on the onchange event getting fired by the first one. Changing the value via script doesn't trigger the event, but fortunately this is pretty easy to do using the .fireEvent method. This example sets the value of the Region field to North America (i.e. 11) and then fires the onchange event for the field which triggers the Javascript that updates the second field. This example also demonstrates a simple method of attaching to an existing browser already pointed to the desired site if it exists and creating a new one if not.

#include <IE.au3>

$sUrl = "http://creative.com/language.asp?sDestUrl=/support/downloads"

$oIE = _IEAttach($sUrl, "url")
If not isObj($oIE) Then
    $oIE = _IECreate()
    _IENavigate($oIE, $sUrl)
EndIf

$oForm = _IEFormGetObjByName($oIE, "Form1")
$oRegion = _IEFormElementGetObjByName($oForm, "Region")
_IEFormElementSetValue($oRegion, "11")
$oRegion.fireEvent("onchange")

This example creates a browser window, navigates to a webpage and downloads all images to a local folder using the source image name.

#include <IE.au3>

$sImgDir = "c:\foo\"; Please make certain this folder already exists (silent failure if not)
$sWebPage = "http://www.autoitscript.com/forum/index.php?"; webpage with images

$oIE = _IECreate()
_IENavigate($oIE, $sWebPage)
$oIMGs = _IETagNameGetCollection($oIE.document, "img")

; Loop through all IMG tags and save file to local directory using INetGet
For $oIMG in $oIMGs
    $sImgUrl = $oIMG.src
    $sImgFileName = $oIMG.nameProp
    INetGet($sImgUrl,  $sImgDir & $sImgFileName)
Next

You can find more about the attributes of the IMG tag at MSDN

Other helpful posts:

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

The most common cause of errors when using these functions will be caused by passing the wrongtype of object to them (Window instead of Document, Form instead of FormElement etc.). This will cause all of the property and method references to fail very cryptically.

Ideally we would be able to test the object type and trap for errors before they occur -- Sven, if you're listening this is why I put the request in the V3 Ideal Lab for an ObjTypeName() function.

I know no way of getting this information with the current AutoIt implementation, but if anyone knows a trick or two, please let me know.

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

Nice work!

I think it would also be nice to have functions that can control IE Options, proxies, set homepage, etc.  Or is this type of stuff covered elsewhere?

-John

<{POST_SNAPBACK}>

@quaizywabbit -- thanks! I hope you get as much use out of it as I do out of ANYGUI

@jftuga -- yes, some of those features would make sense. I'll look into it as I have time.

BTW, I updated the code to T1.1 in the base note to fix some obvious bugs and to add another function

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

Wht about these two?:

;===============================================================================================
;
;Function: _IESetHomePage($szNewPage)
;Paramaters: $szNewPage - The URL of the new homepage to set
;Return: On success returns 1
;        On failure sets @error to either of the following and returns the value of @error:
;        0.) Internet Explorer not installed or not installed properly
;        -1.) Couldn't write to registry
;Author(s): rpm91m@gmail.com
;
;=================================================================================================
Func _IESetHomePage($szNewPage)
    If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "") Then
        SetError(0)
        Return 0
    ElseIf RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Start Page", "REG_SZ", $szNewPage) Then
        Return 1
    Else
        SetError(-1)
        Return -1
    EndIf
EndFunc

;===================================================================================================

==
;
;Function: _IESetTitle($szNewTitle) (defualt: Microsoft Internet Explorer provided by Compaq)
;Paramters: $szNewTitle - The desired name of the title bar
;Return: On success returns 1
;        On failure sets @error to either of the following and returns the value of @error:
;        0.) Internet Explorer not installed or installed properly
;        -1.) Couldn't write to registry
;Author(s): rpm91m@gmail.com
;
;===================================================================================================

===
Func _IESetTitle($szNewTitle)
    If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "") Then
        SetError(0)
        Return 0
    ElseIf RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Window Title", "REG_SZ", $szNewTitle) Then
        Return 1
    Else
        SetError(-1)
        Return -1
    EndIf
EndFunc

:):evil:

EDIT: Oh, you're only using COM I see... :">

Edited by layer
FootbaG
Link to comment
Share on other sites

Dale, this is very wicked. I've got an HTML translation chore and this may help make quick work of it...

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

Dale, this is very wicked. I've got an HTML translation chore and this may help make quick work of it...

<{POST_SNAPBACK}>

@DaveF - Great! Please provide me with feedback as you try to do real work with this... it'll influence the development and help with documentation.

@layer - thanks... there is a COM interface for setting the title (dynamically, not the default value) but I have not seen anything yet that sets the homepage... most of this work is focused on manipulating the DOM (document object model) and homepage, default title etc. functionality is focused a layer above that in the browser implementation. It is a logical extension however and your registry routines can be included unless I find a COM method of performing the same functions.

thanks,

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

See the basenote for Version T1.2. A bunch of new and consolidated functions. More documentation too. Still not many examples though :)

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

See the basenote for Version T1.3

A significant addition is the _IEClickImg() function that allow you to click graphic buttons. It allows matching images by alt text, name or src (i.e. the image file name). Functions to get an image collection and click by image index will be in the next release.

See Post 3 in this thread for a growing collection of 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

This is a mistake in your second example.

_IEFormElementSetValue($o_password, "your password here")

Right is

_IEFormElementSetValue($o_passwd, "your password here")
Log

<{POST_SNAPBACK}>

Thanks -- I caught and fixed that once, but when I moved it to that post I broke it again. It is fixed now (although I switched everything to password instead of passwd).

Thanks,

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

:D:D:):evil:

This is so cool!!!!!

I have been waiting a long time for something like this. Now I can walk over to the Quick Test Pro guy and say na na na na bo bo... I can test web apps now too, and I don't get hit with the yearly license fees for Quick Test Pro.

Thank you so much, keep up the GREAT work

Mike

Link to comment
Share on other sites

Hmm. Do you think it would be possible to build a window spy utility to work with Internet explorer so you could more easily write the scripts? I am finding it very difficult to figure out what names to put down for the _IEFormElementSetValue and other items.

Link to comment
Share on other sites

Hmm.  Do you think it would be possible to build a window spy utility to work with Internet explorer so you could more easily write the scripts?  I am finding it very difficult to figure out what names to put down for the _IEFormElementSetValue and other items.

<{POST_SNAPBACK}>

I've been contemplating something like this, but not like Spy... rather a routine that reports on a particular web page and shows the important elements you need for the UDF functions. I'll see if I can get something in the next release.

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

Dale,

I have another request if it's possible.

_IEobjectGetLocation()

returning the x,y corrdianance

I have some Web sites that I need to hold a mouse over some text in a fake menu bar that is not actually a link, that then displays some more menu items that I then have to click on. Since the menu is not technically a link I need to be able to find the location on the screen of this text and move the mouse to it since clicking the text does nothing I have to do a mousemove to dropdown the menu.

edit: viewing the source code of one of these pages, the menus are created using this.

oCMenu=new makeCoolMenu("oCMenu")
oCMenu.makeMenu

Thanks,

Mike

Edited by MikeOsdx
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...