Jump to content

_IE function problems


Recommended Posts

I'm trying to use _IE functions to go to http://myplace43.pastebin.com/ 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
Link to comment
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
Next
If Ubound($FoIE) - 1 = 1 Then
    $oIE = _IEattach('', 'Instance', 1)
Else
    GUICreate("Select IE", 175, 200)
    GUISetBkColor(0x00E0FFFF)
    $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)
    Next
    GUISetState()
        While 1
            $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    Exit
                Case $msg = $button
                    ExitLoop
            EndSelect
        Wend 
    $oIE = _IEattach('', 'Instance', StringTrimRight(StringRight(GUICtrlRead(GUICtrlRead($listview)),2),1))
    Guidelete()
EndIf
$oForm = _IEFormGetCollection($oIE)
$Form_Count = 0
For $oForm in $oForm
    $Form_Count += 1
    If $oForm.name = '0' then
        $fName = 'This form has no name, use index'
    Else
        $fName = $oForm.name
    EndIf
    $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
    Next
    _ArrayDisplay($Elements, 'Form Name: "' & $fName & '"   -   Index: ' & $Form_Count)
Next
Link to comment
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
 Share

  • Recently Browsing   0 members

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