Jump to content

Ie Form Help


Recommended Posts

well im trying to use ie.au3 to put some information into a field on a website. here is the source for the forms i need to insert some data into. I dont really understand the vbscript but just wondering if there is anyway to tell autoit to insert a $var into the policy number slot?

<script LANGUAGE="VBScript" FOR="keyPanel" EVENT="ReadyStateChange(nReadyState)">
        if keyPanel.ReadyState = 4 then
            'Display ActiveX Control
            keyPanel.style.height = "200"
            document.getElementById("ActiveXLoadMsg").style.display = "none"
            
            keyPanel.AllowKeywordDuplication = true
            keyPanel.ShowRelations = True
            keyPanel.ShowOperators = True
                keyPanel.KeywordTypes = "<ElementCollection><Element NAME=""KeywordType""><PROPERTY DATATYPE=""Long"" NAME=""DataLength"">10</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""DataType"">2</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""distributionType"">0</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Hidden"">false</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""ID"">103</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""InformationOnly"">false</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Mask""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""MustExist"">true</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Name"">Policy Number</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""rawKeyTypeFlags"">81920</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Static""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""UseDataSet"">false</PROPERTY></Element><Element NAME=""KeywordType""><PROPERTY DATATYPE=""Long"" NAME=""DataLength"">51</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""DataType"">2</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""distributionType"">0</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Hidden"">false</PROPERTY></Element></ElementCollection>"
            keyPanel.ShowKeywordDropDown = False
            keyPanel.ElementQueryURL = "http:blahblah"
        end if
        
    </SCRIPT>
Link to comment
Share on other sites

I don't know if it would work, but you could read the html into your script, then add

$src=StringReplace($src,'NAME=""Name"">Policy Number','NAME=""Name"" Value='&$var&'>Policy Number')

and then write it back to the window... I never tried working with vbscript, but I gave it a shot.

Hope I helped,

Sparkes.

Edited by Andrew Sparkes

---Sparkes.

Link to comment
Share on other sites

Use _IEDocReadHTML() and _IEDocWriteHTML():

;===============================================================================
;
; Function Name:    _IEDocReadHTML()
; Description:      Retrieves the full HTML source of a document
; Parameter(s):  $o_object   - InternetExplorer.Application, Window or Frame object
; Requirement(s):   AutoIt3 Beta with COM support (post 3.1.1)
; Return Value(s):  Success - HTML included in the <HTML> of the docuement, including the <HTML> and </HTML> tags
;                   Failure - 0 and sets @ERROR to 1
; Author(s):        Dale Hohm
;
;===============================================================================
;
Func _IEDocReadHTML($o_object)
    If IsObj($o_object) Then
        SetError(0)
        Return $o_object.document.getElementsByTagName("HTML").item(0).outerHTML
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc

;===============================================================================
;
; Function Name:    _IEDocWriteHTML()
; Description:      Replaces the HTML for the entire document
; Parameter(s):  $o_object   - InternetExplorer.Application, Window or Frame object
;                   $s_html     - the HTML string to write to the document
; Requirement(s):   AutoIt3 Beta with COM support (post 3.1.1)
; Return Value(s):  Success - 1
;                   Failure - 0 and sets @ERROR to 1
; Author(s):        Dale Hohm
;
;===============================================================================
;
Func _IEDocWriteHTML($o_object, $s_html)
    If IsObj($o_object) Then
        $o_object.document.Write($s_html)
        $o_object.document.close()
        SetError(0)
        Return 1
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc
Edited by Andrew Sparkes

---Sparkes.

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...