-
Posts
5,930 -
Joined
-
Last visited
-
Days Won
1
Reputation Activity
-
DaleHohm got a reaction from mLipok in Phone Dialer (using COM to modem on serial port)
I posted a COM phone dialer a while back as an answer to another post. It used the MSComm component and I have since learned that many people will not have the MSComm ocx file on thier system (unless they once had VB6 installed). It is a royalty component and therefore cannot be redistributed.
Fortunately, there is a freeware version created to be a full emulation of that control that you can download and install from HardAndSoftware. You'll find the download link here: NetComm Update: New Location
Edit: Note, this needs the post 3.1.1 beta for COM support
Here is the Microsoft MSComm example:
; Set a COM Error handler -- only one can be active at a time (see helpfile) $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $sNumberToDial = "5551212" Dial($sNumberToDial) Exit Func Dial($pNum, $time2wait = 5000) dim $FromModem = "" $DialString = "ATDT" & $pNum & ";" & @CR $com = ObjCreate ("MSCommLib.MSComm") With $com .CommPort = 3 .PortOpen = True .Settings = "9600,N,8,1" .InBufferCount = 0 .Output = $DialString EndWith $begin = TimerInit() While 1 If $com.InBufferCount Then $FromModem = $FromModem & $com.Input;* Check for "OK". If StringInStr($FromModem, "OK") Then;* Notify the user to pick up the phone. MsgBox(0, "Phone", "Please pick up the phone and either press Enter or click OK") ExitLoop EndIf EndIf If (TimerDiff($begin) > $time2wait) Then MsgBox(0, "Error", "No response from modem on COM" & $com.CommPort & " in " & $time2wait & " milliseconds") Exit EndIf WEnd $com.Output = "ATH" & @CR $com.PortOpen = False $com = 0 EndFunc;==>Dial Func MyErrFunc() ; Set @ERROR to 1 and return control to the program following the trapped error SetError(1) MsgBox(0, "Error", "Error communicating with modem on COM" );& $com.CommPort) Exit EndFunc;==>MyErrFunc
Here is the freeware NETComm example:
; Set a COM Error handler -- only one can be active at a time (see helpfile) $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $sNumberToDial = "5551212" Dial($sNumberToDial) Exit Func Dial($pNum, $time2wait = 5000) dim $FromModem = "" $DialString = "ATDT" & $pNum & ";" & @CR $com = ObjCreate ("NETCommOCX.NETComm") With $com .CommPort = 3 .PortOpen = True .Settings = "9600,N,8,1" .InBufferCount = 0 .Output = $DialString EndWith $begin = TimerInit() While 1 If $com.InBufferCount Then $FromModem = $FromModem & $com.InputData;* Check for "OK". If StringInStr($FromModem, "OK") Then;* Notify the user to pick up the phone. MsgBox(0, "Phone", "Please pick up the phone and either press Enter or click OK") ExitLoop EndIf EndIf If (TimerDiff($begin) > $time2wait) Then MsgBox(0, "Error", "No response from modem on COM" & $com.CommPort & " in " & $time2wait & " milliseconds") Exit EndIf WEnd $com.Output = "ATH" & @CR $com.PortOpen = False $com = 0 EndFunc;==>Dial Func MyErrFunc() ; Set @ERROR to 1 and return control to the program following the trapped error SetError(1) MsgBox(0, "Error", "Error communicating with modem on COM" );& $com.CommPort) Exit EndFunc;==>MyErrFunc
Enjoy,
Dale
Edit: Added note about need for AutoIt beta and link to it
Edit2: Created seperate examples for MSComm and NETComm... NETComm uses the property .InputData instead of .Input -- thanks KenE!
-
DaleHohm got a reaction from KingOfNothing in How To Use _IELoadWait() Properly
_IELoadWaitTimeout will change the length of the timeout. The default is 5 minutes - set it lower. Look at the @error values for _IELoadWait to find the value returned after a timeout and test for it.
Regarding PsaltyDS's comment... yes, I would rather you spend 30-40 minutes figuring this out on your own. Please remember that this is a very busy forum and anything that gets posted may be read by hundreds of people... do the math. And it may have taken me 3 minutes to write this reply, but who is to say that my 3 minutes isn't more valuable than your 30-40 (actually, I already know that it is - to me. I only spend my time here replying in hopes that you will learn from it and ask better questions in the future... if not, I'll keep my 3 minutes next time).
Dale
-
DaleHohm got a reaction from KingOfNothing in Internet Explorer Automation UDF library
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
-
DaleHohm got a reaction from ss26 in IE Get an attribute
Try this:
#include <IE.au3> $oIE = _IEAttach("IE Get an attribute") $oLinks = _IELinkGetCollection($oIE) For $oLink in $oLinks ConsoleWrite($oLink.getAttributeNode('onclick').NodeValue & @CRLF) Next
Dale
-
DaleHohm got a reaction from vick in Can't automate <input type=file ... > tag in IE
Here's an example of how to automat this and get around the security restriction:
#include <IE.au3> $oIE = _IE_Example("form") $oT = _IEGetObjById($oIE, 'fileExample') MouseMove(_IEPropertyGet($oT, "screenx") + _IEPropertyGet($oT, "width") - 10, _ _IEPropertyGet($oT, "screeny") + _IEPropertyGet($oT, "height")/2) MouseClick("left") WinWait("Choose File to Upload") $hChoose = WinGetHandle("Choose File to Upload") ControlSetText($hChoose, "", "Edit1", "C:\AUTOEXEC.BAT") ControlClick($hChoose, "", "Button2")
Dale
-
DaleHohm got a reaction from PoojaKrishna in passing window handle between scripts
In recent betas, there is a new HWnd statement that converts a variant into an HWnd. I did a quick test and I think you should be able to convert your HWND to a string, store it in the registry or where ever, read it back and convert it back into an HWND.
If you original HWND value is stored in $hHwnd, then in the code below, $hHwnd and $hHwnd2 should be identical:
$sHwnd = String($hHwnd) $hHwnd2 = HWnd($sHwnd)
Dale
-
DaleHohm got a reaction from TAMIRI in Direct Access Of Ie Cookie Files
The Document object does have a cookie property that you can use to read and write cookies. Typically this would be done from the source document coming from the server, so I am uncertain about security restrictions that may get in your way since I haven't tested.
In any case, something like this:
#include <IE.au3> $oIE = _IECreate("http://you.web.site") $oDoc = _IEDocGetObj($oIE) $oDoc.cookie = $sCookie
$sCookie would be a semi-colon separated string of name-value pairs. The names and values can be arbitrary, but there is one expected one - expires=timeInGMT. If you do not set an expiration, the cookie will not persist when the browser exits. So, for example:
$sCookie = "name=JohnSmith;password=OurDepartment;expires=Mon 05 Aug 2006 02:33:22 GMT"
Dale
-
DaleHohm got a reaction from zaxxon in IE Click Button without Name or ID
Welcome to the world of CSS. The Login button is not a button at all, but just a table cell (TD) with a CSS class that makes it appear as a button.
There could be more elegant ways to do this, but this should work:
$oTDs = _IETagnameGetCollection($oIE, "TD") For $oTD in $oTDs If String(_IEPropertyGet($oTD, "innertext")) = "Login " Then _IEAction($oTD, "click") ExitLoop EndIf Next
Dale
-
DaleHohm got a reaction from mLipok in How do you close an IE tab?
#include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") _IEQuit($oIE2) -
DaleHohm got a reaction from oapjr in Get Collection of Options using IE.au3
To figure this out, you need to study the DOM at MSDN some... but here you go:
#include <IE.au3> $oIE = _IE_Example ("form") $oForm = _IEFormGetObjByName ($oIE, "ExampleForm") $oSelect = _IEFormElementGetObjByName ($oForm, "selectExample") $oOptions = $oSelect.options For $oOption in $oOptions ConsoleWrite($oOption.text & @CR) Next
Dale
-
DaleHohm got a reaction from Realm in LibrariesIE.au3
File Name: IE.au3
File Submitter: DaleHohm
File Submitted: 27 Mar 2013
File Category: Libraries
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: T3.0-0
Last Update: 9/3/12
Requirements: AutoIt3 3.3.9 or higher
This version is checked into the development stream for the next AutoIt beta release, but will work with the most recently released V3.3.9.x beta.
I am releasing it here so that it can get some testing now and help some people with some of the issues it fixes in the realm of COM error handling (and "the WEND error").
This file will be removed when it is included in a public beta release.
Dale
-
DaleHohm reacted to SmOke_N in [IE] Clicking on element (with offset)
Do what Dale said, or maybe try this... I think this may work, but it's not well tested.
#include <IE.au3> Global $go_IE = _IEAttach("https://www.google.com/?gws_rd=ssl", "url") Global $go_GB70 = _IEGetObjById($go_IE, "gb_70") ; be sure to load your window before running, maybe winactivate or something _IE_ClickElemObjByXY($go_GB70) Func _IE_ClickElemObjByXY(ByRef $o_obj, $n_x = Default, $n_y = Default) If Not IsObj($o_obj) Then Return SetError(1, 0, 0) EndIf #cs ; saved for later Local $o_bodyrect = Execute("$o_obj.document.body.getBoundingClientRect()") If Not IsObj($o_bodyrect) Then Return SetError(2, 0, 0) EndIf Local $a_bodyrect[4] = [ _ Number($o_bodyrect.left), _ ; xpos Number($o_bodyrect.top), _ ; ypos Number($o_bodyrect.right) - Number($o_bodyrect.left), _ ; width Number($o_bodyrect.bottom) - Number($o_bodyrect.top)] ; height #ce ; saved for later Local $o_elemrect = Execute("$o_obj.getBoundingClientRect()") If Not IsObj($o_elemrect) Then Return SetError(3, 0, 0) EndIf Local $a_elemrect[4] = [ _ Number($o_elemrect.left), _ ; xpos Number($o_elemrect.top), _ ; ypos Number($o_elemrect.right) - Number($o_elemrect.left), _ ; width Number($o_elemrect.bottom) - Number($o_elemrect.top)] ; height ; we'll make default center $n_x = ($n_x = Default) ? $a_elemrect[0] + Int($a_elemrect[2] / 2) : $n_x + $a_elemrect[0] $n_y = ($n_y = Default) ? $a_elemrect[1] + Int($a_elemrect[3] / 2) : $n_y + $a_elemrect[1] ; I'll leave error checking here for others Execute("$o_obj.document.elementFromPoint($n_x, $n_y).click()") EndFunc -
DaleHohm got a reaction from iwak in [IE] Clicking on element (with offset)
See _IEPropertyGet and it's example. Use it to position the mouse pointer and then click with MouseClick
Dale
-
DaleHohm got a reaction from luger in How do you close an IE tab?
The .Navigate method has no return value, so you must attach to the new IE on your own.
I'd suggest that you put the _IEAttach into a loop, waiting for the new window to be found. Something like:
While 1 $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") If IsObj($oIE2) Then ExitLoop WEND
SmOke_N's method will work too.
Dale
-
DaleHohm got a reaction from Palestinian in How do you close an IE tab?
#include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") _IEQuit($oIE2) -
DaleHohm got a reaction from luger in How do you close an IE tab?
#include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") _IEQuit($oIE2) -
DaleHohm got a reaction from petronio in IE data table dynamic
You may not be allowing enough time for the table to repopulate after clicking next before you try to read it again.
Try putting in a Sleep(xxx) to see if it solves your problem. If it does, then use a more sophisticated delay (you may be able to use _IELoadWait on the table or you may have to check it's content more directly).
Dlae
-
DaleHohm got a reaction from redline147 in Javascript Alert Popup Issue
Instead of using .click on the button, use .focus and then Send("{ENTER}")
The alert still comes up but your script is free to continue.
I think there is an example of the's approach in replys of the IE.au3 thread.
Dale
-
DaleHohm got a reaction from matwachich in IE.au3 scroll down page help
Something like this:
#include <IE.au3>
$oIE = _IECreate("http://freshmeat.net/")
$oIE.document.parentwindow.scroll(0, $oIE.document.body.scrollHeight/2)
Dale
-
DaleHohm got a reaction from sennabot in perform Javascript calls on a webpage - HOW ?
There is also eval and execScript. The former brings back a return value, the later does not. Some have also used _IENavigate.
$oIE.document.parentwindow.execScript('var x = 9; alert(x * 12);')
$result = $oIE.document.parentwindow.eval('var x = 9; x * 12;')
MsgBox(0, "Result", $result)
Dale
Edit: typo
-
DaleHohm got a reaction from BlackHoleSun in Phone Dialer (using COM to modem on serial port)
I posted a COM phone dialer a while back as an answer to another post. It used the MSComm component and I have since learned that many people will not have the MSComm ocx file on thier system (unless they once had VB6 installed). It is a royalty component and therefore cannot be redistributed.
Fortunately, there is a freeware version created to be a full emulation of that control that you can download and install from HardAndSoftware. You'll find the download link here: NetComm Update: New Location
Edit: Note, this needs the post 3.1.1 beta for COM support
Here is the Microsoft MSComm example:
; Set a COM Error handler -- only one can be active at a time (see helpfile) $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $sNumberToDial = "5551212" Dial($sNumberToDial) Exit Func Dial($pNum, $time2wait = 5000) dim $FromModem = "" $DialString = "ATDT" & $pNum & ";" & @CR $com = ObjCreate ("MSCommLib.MSComm") With $com .CommPort = 3 .PortOpen = True .Settings = "9600,N,8,1" .InBufferCount = 0 .Output = $DialString EndWith $begin = TimerInit() While 1 If $com.InBufferCount Then $FromModem = $FromModem & $com.Input;* Check for "OK". If StringInStr($FromModem, "OK") Then;* Notify the user to pick up the phone. MsgBox(0, "Phone", "Please pick up the phone and either press Enter or click OK") ExitLoop EndIf EndIf If (TimerDiff($begin) > $time2wait) Then MsgBox(0, "Error", "No response from modem on COM" & $com.CommPort & " in " & $time2wait & " milliseconds") Exit EndIf WEnd $com.Output = "ATH" & @CR $com.PortOpen = False $com = 0 EndFunc;==>Dial Func MyErrFunc() ; Set @ERROR to 1 and return control to the program following the trapped error SetError(1) MsgBox(0, "Error", "Error communicating with modem on COM" );& $com.CommPort) Exit EndFunc;==>MyErrFunc
Here is the freeware NETComm example:
; Set a COM Error handler -- only one can be active at a time (see helpfile) $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $sNumberToDial = "5551212" Dial($sNumberToDial) Exit Func Dial($pNum, $time2wait = 5000) dim $FromModem = "" $DialString = "ATDT" & $pNum & ";" & @CR $com = ObjCreate ("NETCommOCX.NETComm") With $com .CommPort = 3 .PortOpen = True .Settings = "9600,N,8,1" .InBufferCount = 0 .Output = $DialString EndWith $begin = TimerInit() While 1 If $com.InBufferCount Then $FromModem = $FromModem & $com.InputData;* Check for "OK". If StringInStr($FromModem, "OK") Then;* Notify the user to pick up the phone. MsgBox(0, "Phone", "Please pick up the phone and either press Enter or click OK") ExitLoop EndIf EndIf If (TimerDiff($begin) > $time2wait) Then MsgBox(0, "Error", "No response from modem on COM" & $com.CommPort & " in " & $time2wait & " milliseconds") Exit EndIf WEnd $com.Output = "ATH" & @CR $com.PortOpen = False $com = 0 EndFunc;==>Dial Func MyErrFunc() ; Set @ERROR to 1 and return control to the program following the trapped error SetError(1) MsgBox(0, "Error", "Error communicating with modem on COM" );& $com.CommPort) Exit EndFunc;==>MyErrFunc
Enjoy,
Dale
Edit: Added note about need for AutoIt beta and link to it
Edit2: Created seperate examples for MSComm and NETComm... NETComm uses the property .InputData instead of .Input -- thanks KenE!
-
DaleHohm got a reaction from Palestinian in problem about the UDF: _IEAction
There are two scenarios that result in an apparent "hang" like this...
1) when the page does not yet appear to IE.au3 that it is completely loaded and _IELoadWait has control and is waiting for your page to signal it is done... in this case, _IELoadWaitTimeOut can be used.
2) when Javascript or event processing on the browser-side prevent control from returning to your script until some browser-side action completes -- in this case, an alert box of some sort.
I have to answer this question here in the forums once every few weeks, so I need to figure out a way to document it where people can find it. For now, I put a new example in helpfile in the recent beta that shows you how to work around the issue. This is not a bug, it is normal - however complicated.
Here are the helpfile examples for _IEAction, please see Example 2:
; ******************************************************* ; Example 1 - Open a browser with the "form" example, get a reference ; to the submit button by name and "click" it. This technique ; of submitting forms is useful because many forms rely on Javascript ; code and "onclick" events on their submit button making _IEFormSubmit() ; not perform as expected ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("form") $oSubmit = _IEGetObjByName ($oIE, "submitExample") _IEAction ($oSubmit, "click") _IELoadWait ($oIE) ; ******************************************************* ; Example 2 - Same as Example 1, except instead of using click, give the element focus ; and then use ControlSend to send Enter. Use this technique when the ; browser-side scripting associated with a click action prevents control ; from being automatically returned to your code. ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("form") $oSubmit = _IEGetObjByName ($oIE, "submitExample") $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction ($oSubmit, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") ; Wait for Alert window, then click on OK WinWait("Windows Internet Explorer", "ExampleFormSubmitted") ControlClick("Windows Internet Explorer", "ExampleFormSubmitted", "[CLASS:Button; TEXT:OK; Instance:1;]") _IELoadWait ($oIE)
Dale
-
DaleHohm got a reaction from Palestinian in ie.au3 tutorial/direction needed
Don't guess, use something like DebugBar (or another DOM inspector) to see what it is. If you use DebugBar, use the Drag Target onto the element you want to see it's source and use the "View Source" icon in the DebugBar toolbar to see if you have frames to navigate.
Dale
-
DaleHohm got a reaction from Palestinian in Internet Explorer ControlSend issue
Bad idea to spam a thread like this with an unrelated issue. Since you want to imply a nebulous problem, I'll respond here to clear this up for anyone who may wander in here in the future.
There are no changes in the new IE.au3 as it relates to frames.
Each frame is a document container, each document has it's own DOM (document object model). Therefore, you cannot reference an element in the DOM of a frame from another DOM - you must get a reference to the new DOM first. Because you cannot know by looking at the screen that there are multiple DOMs at play, people are often confused.
Dale
-
DaleHohm got a reaction from Palestinian in Internet Explorer ControlSend issue
Looks like asynchronous updates and _IELoadWait is oblivious.
You can often check for an element like that... figure out it's ID, check its visibility or content.
Try to use DebugBar (see my sig) to get info about the Please Wait element and then use _IEGetObjById and perhaps _IEPropertyGet innerhtml.
Dale