madmega

IE autologin script, skips login

17 posts in this topic

Hi, like the title says, when i run this script, it doesn't fill in the login/username field, it just skips it.
 

 

#include <IE.au3>

Call ("Signin")

Func Signin ()
Global $oIE = _IEcreate ("https://customers.rolandce.com/login.php")

Local $user_name = _IEGetObjByName ($oIE, "user_name")
Local $password = _IEGetObjByName ($oIE, "password")

_IEFormElementSetValue ($user_name, "myname@me.nl")
_IEFormElementSetValue ($password, "1234567")

EndFunc

 

 

Share this post


Link to post
Share on other sites



Great thank you !!!

Now i have to find a way to press the submit button (which has no name in the code)

Share this post


Link to post
Share on other sites

Try to use TAB:

Send("{TAB}")

I think you would need to have a double TAB to reach log in button after your password field.

Then just send Enter

Send("{Enter}")

Share this post


Link to post
Share on other sites

Have you looked at the _IEFormSubmit function in the Help File?

Share this post


Link to post
Share on other sites
3 hours ago, m16318 said:

Try to use TAB:

Send("{TAB}")

I think you would need to have a double TAB to reach log in button after your password field.

Then just send Enter

Send("{Enter}")

I will try that, thank you

 

Quote

Have you looked at the _IEFormSubmit function in the Help File?

Yes, i did, but nothing happened when i tried that.

 

Share this post


Link to post
Share on other sites

Both of them don't work, any ideas ?
I do not know why it can't be "TABBED" or why ieformsubmit does not work

Share this post


Link to post
Share on other sites

It took around 5 tabs and then enter ;-)

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

You don't have to set $oIE as a global variable since it's only used in one area.

Global $oIE = _IEcreate ("https://customers.rolandce.com/login.php")

 

It'll post in Password but you'll have to take a look at the user/email input box and the submit button. Might want to look at the HTML for those.

#include <IE.au3>

Local $oIE = _IEcreate ("https://customers.rolandce.com/login.php")

$test1 = "Email/Username here"
$test2 = "Password Here"

Local $username = _IEGetObjByName ($oIE, "user_name")
local $password = _IEGetObjByName ($oIE, "password")
local $button = _IEGetObjByName ($oIE, "submit")

_IEFormElementSetValue ($username, $test1)
_IEFormElementSetValue ($password, $test2)
sleep(1000)
$oBtn = _IEGetObjById($oIE, "submit")
_IEAction($oBtn, "click")

 

Edited by aa2zz6

Share this post


Link to post
Share on other sites

Maybe like this:

#include <IE.au3>

_Example()
Func _Example()
    ; do not use Global inside Function
    Local $oIE = _IECreate("https://customers.rolandce.com/login.php")

    Signin($oIE)

EndFunc

Func Signin(ByRef $oIE)
    Local $user_name = _IEGetObjById($oIE, "user_name")
    _IEFormElementSetValue($user_name, "myname@me.nl",0)

    Local $password = _IEGetObjById($oIE, "password")
    _IEFormElementSetValue($password, "1234567",0)

    _IENavigate($oIE, "https://customers.rolandce.com/login-2.php")

EndFunc    ;==>Signin

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites
9 hours ago, mLipok said:

Maybe like this:

#include <IE.au3>

_Example()
Func _Example()
    ; do not use Global inside Function
    Local $oIE = _IECreate("https://customers.rolandce.com/login.php")

    Signin($oIE)

EndFunc

Func Signin(ByRef $oIE)
    Local $user_name = _IEGetObjById($oIE, "user_name")
    _IEFormElementSetValue($user_name, "myname@me.nl",0)

    Local $password = _IEGetObjById($oIE, "password")
    _IEFormElementSetValue($password, "1234567",0)

    _IENavigate($oIE, "https://customers.rolandce.com/login-2.php")

EndFunc    ;==>Signin

 

It seems to work but it won't login, just got the error that something is not correct

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

If you can't submit their form, try making your own and submitting it.  I tried it and got the same results as entering bad data into the form normally.  Add your credentials to the code below and see if it works...

#include <IE.au3>
$Username = "myname@me.nl"
$Password = "1234567"
Local $oIE = _IECreate()
Local $sHTML = ""
$sHTML &= "<HTML><BODY>" & @CRLF
$sHTML &= "<form id='contact_form' action='https://customers.rolandce.com/login-2.php' method='post'>" & @CRLF
$sHTML &= "  <input type='hidden' name='rce_target' value='0' >" & @CRLF
$sHTML &= "  <input type='hidden' name='current_lid' value='EN' />" & @CRLF
$sHTML &= "  <input type='text' name='user_name' id='user_name' value='" & $Username & "' />" & @CRLF
$sHTML &= "  <input type='password' name='password' id='password' value='" & $Password & "' /> " & @CRLF
$sHTML &= "  <input name='token' id='token_input' class='form_input ' type='password' />" & @CRLF
$sHTML &= "  <button type='submit' class='positive'>Log In</button> " & @CRLF
$sHTML &= "</form></BODY></HTML>"
_IEDocWriteHTML($oIE, $sHTML)
_IEAction($oIE, "refresh")
$oForm = _IEFormGetObjByName($oIE, "contact_form")
_IEFormSubmit($oForm)

 

Edited by MuffinMan
Adding details

Share this post


Link to post
Share on other sites

This seems to work great, but when i put it in the rest of my script, it seems to halt everything.
Maybe i am doing it wrong but after the _IEFormSubmit($oForm) nothing happens.

 

#include <IE.au3>

FileDelete("C:\roland\*")

Call ("Signin")

Func Signin ()
$Username = "login"
$Password = "paswword"
Local $oIE = _IECreate()
Local $sHTML = ""
$sHTML &= "<HTML><BODY>" & @CRLF
$sHTML &= "<form id='contact_form' action='https://customers.rolandce.com/login-2.php' method='post'>" & @CRLF
$sHTML &= "  <input type='hidden' name='rce_target' value='0' >" & @CRLF
$sHTML &= "  <input type='hidden' name='current_lid' value='EN' />" & @CRLF
$sHTML &= "  <input type='text' name='user_name' id='user_name' value='" & $Username & "' />" & @CRLF
$sHTML &= "  <input type='password' name='password' id='password' value='" & $Password & "' /> " & @CRLF
$sHTML &= "  <input name='token' id='token_input' class='form_input ' type='password' />" & @CRLF
$sHTML &= "  <button type='submit' class='positive'>Log In</button> " & @CRLF
$sHTML &= "</form></BODY></HTML>"
_IEDocWriteHTML($oIE, $sHTML)
_IEAction($oIE, "refresh")
$oForm = _IEFormGetObjByName($oIE, "contact_form")
_IEFormSubmit($oForm)


EndFunc

#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>

; Download a file in the background.
; Wait for the download to complete.

Example()
_IEQuit($oIE)

Func Example()
    ; Save the downloaded file to the temporary folder.
    Local $sFilePath = _WinAPI_GetTempFileName("c:\roland")


    ; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected.
    Local $iBytesSize = InetGet("https://customers.rolandce.com/rcenet/export_avail.php", "c:\roland\roland.xls", $INET_BINARYTRANSFER)

EndFunc   ;==>Example



#include <FTPEx.au3>
#include <MsgBoxConstants.au3>


Local $sServer = 'ftp.myftp.com'
Local $sUsername = 'login'
Local $sPass = 'pass'

Local $hOpen = _FTP_Open('MyFTP Control')
Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass)
If @error Then
    MsgBox($MB_SYSTEMMODAL, '_FTP_Connect', 'ERROR=' & @error)
Else

_FTP_FilePut ($hConn, 'c:\roland\roland.xls' , '/roland.xls')

EndIf
Local $iFtpc = _FTP_Close($hConn)
Local $iFtpo = _FTP_Close($hOpen)

 

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Ah...i changed it to _IEFormSubmit($oForm, 0) and now it seems to work.

Edited by madmega

Share this post


Link to post
Share on other sites
2 minutes ago, madmega said:

But i am getting this error

IEQuit(): undefined function.

IEQuit 

or 

_IEQuit 

 

??

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Indeed it was a stupid typo, _IEQuit  it was...but the whole script works !!!:)

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