Jump to content

Setting the value on input form


Recommended Posts

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?

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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

 

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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