Guitz

AutoComplete script

14 posts in this topic

I created a script that autocomplete a form but it doesn't work and I don't know why. Could you help me? Thank you

 

HTML code:

<form action="adauga_comentariu.php" method="POST">
            Nume:<input type="text" required name="nume_utilizator" id="nume"><br><br>
            Email:<input type="email" required name="adresa_email" id="email"><br><br>
            Comentariu:<br>
            <textarea name="comentariu" cols="45" id="comentariu"></textarea><br><br>
            <input type="hidden" name="id_model" value="<?=$id_model?>">
            <center><input type="submit" id="adauga" value="Adaugă" style="width: 100px; height: 30px; font-size: 16px;"></center>
        </form>

 

AutoIT code:

#include <IE.au3>

Local $mag = _IECreate("http://localhost/mag/model.php?id_model=8")
Sleep(2000)

Local $nume= _IEGetObjById($mag,"nume")
Local $email= _IEGetObjById($mag,"email")
Local $comentariu= _IEGetObjById($mag,"comentariu")

_IEFormElementSetValue ($nume,"Test")
_IEFormElementSetValue ($email,"test@test.com")
_IEFormElementSetValue ($comentariu,"Test Test Test Test Test")

 

AutoIT errors:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Andrei\Desktop\emag.ro.au3"    
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023179, Browser has been deleted prior to operation.)
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType

Share this post


Link to post
Share on other sites



For me is working right.

#include <IE.au3>

Local $mag = _IECreate("")


Local $sHTML = ""
$sHTML &= '<form action="adauga_comentariu.php" method="POST">' & @CRLF
$sHTML &= 'Nume:<input type="text" required name="nume_utilizator" id="nume"><br><br>' & @CRLF
$sHTML &= 'Email:<input type="email" required name="adresa_email" id="email"><br><br>'& @CRLF
$sHTML &= 'Comentariu:<br>' & @CRLF
$sHTML &= '<textarea name="comentariu" cols="45" id="comentariu"></textarea><br><br>' & @CRLF
$sHTML &= '<input type="hidden" name="id_model" value="<?=$id_model?>">' & @CRLF
$sHTML &= '<center><input type="submit" id="adauga" value="Adauga" style="width: 100px; height: 30px; font-size: 16px;"></center>' & @CRLF
$sHTML &= ' </form>' & @CRLF



_IEDocWriteHTML($mag, $sHTML)


Local $nume= _IEGetObjById($mag,"nume")
Local $email= _IEGetObjById($mag,"email")
Local $comentariu= _IEGetObjById($mag,"comentariu")

_IEFormElementSetValue ($nume,"Test")
_IEFormElementSetValue ($email,"test@test.com")
_IEFormElementSetValue ($comentariu,"Test Test Test Test Test")

Saludos

Share this post


Link to post
Share on other sites

Is the local web server up and running?


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

Yes, I use XAMPP and it is working

Share this post


Link to post
Share on other sites

For me is working right.

#include <IE.au3>

Local $mag = _IECreate("")


Local $sHTML = ""
$sHTML &= '<form action="adauga_comentariu.php" method="POST">' & @CRLF
$sHTML &= 'Nume:<input type="text" required name="nume_utilizator" id="nume"><br><br>' & @CRLF
$sHTML &= 'Email:<input type="email" required name="adresa_email" id="email"><br><br>'& @CRLF
$sHTML &= 'Comentariu:<br>' & @CRLF
$sHTML &= '<textarea name="comentariu" cols="45" id="comentariu"></textarea><br><br>' & @CRLF
$sHTML &= '<input type="hidden" name="id_model" value="<?=$id_model?>">' & @CRLF
$sHTML &= '<center><input type="submit" id="adauga" value="Adauga" style="width: 100px; height: 30px; font-size: 16px;"></center>' & @CRLF
$sHTML &= ' </form>' & @CRLF



_IEDocWriteHTML($mag, $sHTML)


Local $nume= _IEGetObjById($mag,"nume")
Local $email= _IEGetObjById($mag,"email")
Local $comentariu= _IEGetObjById($mag,"comentariu")

_IEFormElementSetValue ($nume,"Test")
_IEFormElementSetValue ($email,"test@test.com")
_IEFormElementSetValue ($comentariu,"Test Test Test Test Test")

Saludos

For me isn't working this code

Share this post


Link to post
Share on other sites

 Does code I posted work for you?

What console output do you get running my code?

Saludos

Share this post


Link to post
Share on other sites

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Andrei\Desktop\test.au3"    
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023179, Browser has been deleted prior to operation.)
--> IE.au3 T3.0-2 Error from function _IEDocWriteHTML, $_IESTATUS_InvalidObjectType (Expected document element)
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
>Exit code: 0    Time: 0.9284

 

Share this post


Link to post
Share on other sites

this is the code

#include <IE.au3>

Local $mag = _IECreate("http://localhost/mag/model.php?id_model=8")


Local $sHTML = ""
$sHTML &= '<form action="adauga_comentariu.php" method="POST">' & @CRLF
$sHTML &= 'Nume:<input type="text" required name="nume_utilizator" id="nume"><br><br>' & @CRLF
$sHTML &= 'Email:<input type="email" required name="adresa_email" id="email"><br><br>'& @CRLF
$sHTML &= 'Comentariu:<br>' & @CRLF
$sHTML &= '<textarea name="comentariu" cols="45" id="comentariu"></textarea><br><br>' & @CRLF
$sHTML &= '<input type="hidden" name="id_model" value="<?=$id_model?>">' & @CRLF
$sHTML &= '<center><input type="submit" id="adauga" value="Adauga" style="width: 100px; height: 30px; font-size: 16px;"></center>' & @CRLF
$sHTML &= ' </form>' & @CRLF



_IEDocWriteHTML($mag, $sHTML)


Local $nume= _IEGetObjById($mag,"nume")
Local $email= _IEGetObjById($mag,"email")
Local $comentariu= _IEGetObjById($mag,"comentariu")

_IEFormElementSetValue ($nume,"Test")
_IEFormElementSetValue ($email,"test@test.com")
_IEFormElementSetValue ($comentariu,"Test Test Test Test Test")

 

Share this post


Link to post
Share on other sites

It look like your server is not working.

try the code I posted with _IECreate("") Instead _IECreate("http://localhost/mag/model.php?id_model=8")

 

Saludos

Share this post


Link to post
Share on other sites

Without my link it works. I need to make something to work using the link...

Share this post


Link to post
Share on other sites

Does your default broswer or any loads that page succesfully ? http://localhost/mag/model.php?id_model=8

 

Saludos

Share this post


Link to post
Share on other sites

Yes, both Chrome and IE load the page succesfully

Share this post


Link to post
Share on other sites

Could we maybe find out a diffrence in iexplore here?

it could be you use a really recent or windows 10 related thing that makes the diffrence?

Long story short, could you tell us our iexplore version since iexplore is used for the used UDF

Share this post


Link to post
Share on other sites

I am using Internet Explorer v.11

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