We'll now have a look at the collection of functions for creating, attaching to, reading from, and manipulating Internet Explorer. Internet Explorer automation functions start as _IExxx
.
Open SciTE from the AutoIt Program Group and start writing source code.
We can optionally update a few features to improve results:
IE3.au3
beta library from http://www.autoitscript.com/forum/files/file/227-ieau3/, and then copy and paste it to your script folder.The following are two examples of interaction with Internet Explorer:
#include <IE.au3> $o_IE = _IECreate () _IENavigate ($o_IE, "http://autoitscript.com") MsgBox(0,"IE.au3 Test","Enter for next Internet Explorer command: Click text Forum ") _IELinkClickByText ($o_IE, "Forum") MsgBox(0,"IE.au3 Test","Enter for next Internet Explorer command: Click text Wiki") _IELinkClickByText ($o_IE, "Wiki")
#include <IE.au3> $oIE = _IECreate() _IENavigate($oIE, "http://www.autoitscript.com/") $body = _IEBodyReadHTML($oIE) If StringInStr($body, "autoit") Then MsgBox(0, "Success", "The string was found. Press enter to modify web page") $newbody = StringReplace($body, "autoit", "AUTOMATION: YOUR NAME HERE, XXX!") _IEBodyWriteHTML($oIE, $newbody) Else MsgBox(0, "Fail", "The string was NOT found") EndIf
_IExxx
functions work for Internet Explorer (IE) automation. You create a navigation object with _IENavigate
for a web page, and then send commands, for example, click on links. You can also try using _IEAction($object, "many actions E.G. click")
.
_IEbodyWriteHTML()
writes HTML into an active page object.
For more on this, visit http://www.youtube.com/watch?v=1TVf2xZDdfE.
Let us look at two more subjects. The first one is about getting Internet Explorer values and IDs to manage them later in any AutoIt script. The second one is about how to automate Firefox using an external Firefox automation tool (iMacros), and how to get this working inside our AutoIt applications.
Extra tools, _IExxx
functions parameters, and debug Scripts can be obtained from the following links:
Firefox Portable automation is possible by creating an iMacros script, and running it within AutoIt.
You can download Firefox Portable from http://portableapps.com/apps/internet/firefox_portable and iMacros from https://addons.mozilla.org/es/firefox/addon/imacros-for-firefox/, and then install them.
Then, you can create an AutoIt script to run any previously stored iMacros as:
Run("FirefoxPortable.exe imacros://run/?m=WP-backup.iim")
Wp-backup.iim imacro
should be created using the iMacros interface. You can modify iMacros behavior on-the-fly (reading, writing, and running this template iMacros script file).
A working AutoIt iMacros template can be downloaded here: