zyghy

Setting the value on input form

7 posts in this topic

i try setting the value on input form useing _IEFormElementSetValue

Value set ok but not appear (dissapear in 1secound after autoit script insert it in text area)

 

html code

<form action="http://website.com/reactivare/4dc0404e5270bcf6525a0f6519ca17c324aa60d9" method="post">
                                <table cellpadding="0" cellspacing="0" width="166">                                
                                    <tbody><tr>
                                        <td class="pad">
                                                                                                                                    <input type="text" name="email" class="inputField" value="- E-mail Adress -" style="width:146px; padding-left:5px;" onclick="this.value='';">
                                            <input type="text" name="cod" class="inputField" value="- Verify Code -" style="width:125px; padding-left:5px;" onclick="this.value='';">
                                            <input type="image" src="http://website.com/images/submit.jpg" name="submitReactivareAnunt" class="inputField">
                                        </td>
                                    </tr>
                                </tbody></table>
                                </form>

 

my autoit

Global $oIE = _IECreate("http://website.com")
$val1 = "barca_barca123@yahoo.com" ;MAIL
$val2 = "YWNhMjNkMzBhMzAwNzFl" ; COD
$email = _IEGetObjByName ($oIE, "email",1)
_IEFormElementSetValue ($email, $val1)
_IEFormSubmit($email)
$cod = _IEGetObjByName ($oIE, "cod",1)
_IEFormElementSetValue($cod, $val2)
_IEFormSubmit($cod)

 

Anyone can help me?

Share this post


Link to post
Share on other sites



Welcome to AutoIt and the forum!

You need to add some error checking to your script!
The _IE* functions set the @error macro to a non zero value if there is any problem.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

how can i  i do that ? for see errors

Share this post


Link to post
Share on other sites

Just an example for the first call in your script:

Global $oIE = _IECreate("http://website.com")
If @error <> 0 Then Exit MsgBox($MB_ICONERROR, "Error!", "_IECreate returned error " & @error)

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Quick and dirty error checking;

Every function has a return value. see HelpFile 

For instance:

This function: _IEFormElementSetValue

Will give you one of the following Return Values:

Quote
Success: 1.
Failure: 0 and sets the @error flag to non-zero.
@error: 2 ($_IEStatus_COMError) - COM Error in Object reference
3 ($_IEStatus_InvalidDataType) - Invalid Data Type
4 ($_IEStatus_InvalidObjectType) - Invalid Object Type
@extended: Contains invalid parameter number

In its simplest form you will get a 1 or a 0.

1 = success

0 = Failure

If you get success your script continues..

But failure will usually stop the script abruptly and you wont know why, that where these numbers come in; 2,3 &4

These are error codes telling you want went wrong.

Example:

RegWrite("mistake")  ; a function bound for failure

If @error Then
    ConsoleWrite("Error = " & @error & @CRLF)   
    ; look in the console we get error 2 
    ;2 = unable to open requested main key

Else
    MsgBox(0, "", "Success")
EndIf

 

Share this post


Link to post
Share on other sites

Great explanation :)
But I'm sure the user would have found himself in the help file when showing some effort ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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