Sign in to follow this  
Followers 0

_IE function problems

3 posts in this topic

#1 ·  Posted (edited)

I'm trying to use _IE functions to go to and type a string into the text box there, and sumbit. I want it to append to the end if there is already text in the box.

I don't have a problem spawning the window, but I'm having a lot of trouble with the Forms/elements. Can anyone show me how this would be done? I should be able to figure out everything else I need to know based on this.

Edited by firefri

Share this post

Link to post
Share on other sites

Here's an example of how to do what you are asking:

#include <IE.au3>
$oIE = _IEAttach ("myplace");Attaches to IE.
$oForm = _IEFormGetObjByName ($oIE, "editor");Gets the Form by name.
$oText = _IEFormElementGetObjByName ($oForm, "code2");Gets the Form Element by name.
_IEFormElementSetValue ($oText, _IEFormElementGetValue($oText) & ' NEW TEXT!');Sets that Element with the text currently in it and the new text.

You can download a utility called DebugBar to help get the form and element names. Or use a ghetto script like this:

#include <IE.au3>
#include <String.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Dim $FoIE[1]
For $i = 1 to 20
$oIE = _IEattach('', 'Instance', $i)
If @Error <> 0 AND $i = 1 then Exit msgbox(0,'Error','No Internet Explorer windows found')
    If isobj($oIE) Then _arrayadd($FoIE, $oIE)
    If Not isobj($oIE) Then Exitloop
If Ubound($FoIE) - 1 = 1 Then
    $oIE = _IEattach('', 'Instance', 1)
    GUICreate("Select IE", 175, 200)
    $listview = GUICtrlCreateListView("Internet Explorer Name      |Instance", 10, 10, 155, 150, -1)
    $button = GUICtrlCreateButton("Select", 5, 165, 165, 30)
    Dim $item[Ubound($FoIE)]
    For $i = 1 to Ubound($FoIE) - 1
        $item[$i] = GUICtrlCreateListViewItem($FoIE[$i].LocationName & '|' & $i, $listview)
        While 1
            $msg = GUIGetMsg()
                Case $msg = $GUI_EVENT_CLOSE
                Case $msg = $button
    $oIE = _IEattach('', 'Instance', StringTrimRight(StringRight(GUICtrlRead(GUICtrlRead($listview)),2),1))
$oForm = _IEFormGetCollection($oIE)
$Form_Count = 0
For $oForm in $oForm
    $Form_Count += 1
    If $ = '0' then
        $fName = 'This form has no name, use index'
        $fName = $
    $oQuery = _IEFormElementGetCollection($oForm,-1)
    Dim $Elements[@extended + 1][3]
    $Elements[0][0] = 'Name                           '
    $Elements[0][1] = 'Type                           '
    $Elements[0][2] = 'Value                              '
    $E_Count = 0
    For $oQuery in $oQuery
        $E_Count += 1
        $Elements[$E_Count][0] = $oQuery.Name
        $Elements[$E_Count][1] = $oQuery.Type
        $Elements[$E_Count][2] = $oQuery.Value
    _ArrayDisplay($Elements, 'Form Name: "' & $fName & '"   -   Index: ' & $Form_Count)

Share this post

Link to post
Share on other sites

Thanks very much the help! Definitely what I wanted to know.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0