Sign in to follow this  
Followers 0
Sebastian23

Send Form Data and check success

2 posts in this topic

hi community,

i have made a script which automatically fills a form with data. i works pretty fine. the problem is, that the script is not always available. that means from time to time the submit button is not there. my idea now is to try it every second to click the send button until it is sucessfull. my code till there:

#include <IE.au3>

$Year = "2008"
$Month = "08"
$Day =  "10"
$sUsername = "username"
$sName = "namr"
$sTel = "telefon number"
$sEmail = "email address"
$sStarthour = "5"
$sStartmin = "30"
$sEndhour = "6"
$sEndmin = "30"

$sURL = "domain/index.php?res=" & $year & "-" & $month & "-" & $day
$oIE = _IECreate($sURL)


while 1
$oForm = _IEFormGetObjByName($oIE, "form1")
$oUsername = _IEFormElementGetObjByName($oForm, "elementname")
$oName = _IEFormElementGetObjByName($oForm, "name")
$oTel = _IEFormElementGetObjByName($oForm, "tel")
$oEmail = _IEFormElementGetObjByName($oForm, "email")
$oStarthour = _IEFormElementGetObjByName($oForm, "starth")
$oStartmin = _IEFormElementGetObjByName($oForm, "startm")
$oEndhour = _IEFormElementGetObjByName($oForm, "endh")
$oEndmin = _IEFormElementGetObjByName($oForm, "endm")

$oButton = _IEGetObjByName($oForm, "submit")

_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oName, $sName)
_IEFormElementSetValue($oTel, $sTel)
_IEFormElementSetValue($oEmail, $sEmail)
_IEFormElementSetValue($oStarthour, $sStarthour)
_IEFormElementSetValue($oStartmin, $sStartmin)
_IEFormElementSetValue($oEndhour, $sEndhour)
_IEFormElementSetValue($oEndmin, $sEndmin)

ConsoleWrite("Daten eingegeben" & @CRLF)

_IEAction($oButton, "click")
sleep(1000)
$oIE.document.location.reload(False)
sleep(1000)
WEnd

the problem is now that i have to reload the whole page every second. is there are better why to do that? or is it possible to check if an click on the $oButton was successfull?

thank you for your answers!

sebastian23

Share this post


Link to post
Share on other sites



maybe try this, I have no experience with it, so please let me know if it works

While 1
$oButton = _IEGetObjByName($oForm, "submit")
If @error = 0 Then Exitloop
sleep(1000)
Wend

In the beginning there was nothing and then even that exploded - anonymous

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