madmega Posted February 2, 2016 Share Posted February 2, 2016 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 Link to comment Share on other sites More sharing options...
m16318 Posted February 2, 2016 Share Posted February 2, 2016 Try to put 0 at the end, like this: _IEFormElementSetValue ($user_name, "myname@me.nl",0) _IEFormElementSetValue ($password, "1234567",0) Link to comment Share on other sites More sharing options...
madmega Posted February 2, 2016 Author Share Posted February 2, 2016 Great thank you !!! Now i have to find a way to press the submit button (which has no name in the code) Link to comment Share on other sites More sharing options...
m16318 Posted February 2, 2016 Share Posted February 2, 2016 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}") Link to comment Share on other sites More sharing options...
MuffinMan Posted February 2, 2016 Share Posted February 2, 2016 Have you looked at the _IEFormSubmit function in the Help File? Link to comment Share on other sites More sharing options...
madmega Posted February 2, 2016 Author Share Posted February 2, 2016 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. Link to comment Share on other sites More sharing options...
madmega Posted February 2, 2016 Author Share Posted February 2, 2016 Both of them don't work, any ideas ? I do not know why it can't be "TABBED" or why ieformsubmit does not work Link to comment Share on other sites More sharing options...
madmega Posted February 2, 2016 Author Share Posted February 2, 2016 It took around 5 tabs and then enter ;-) Link to comment Share on other sites More sharing options...
aa2zz6 Posted February 2, 2016 Share Posted February 2, 2016 (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 February 2, 2016 by aa2zz6 Link to comment Share on other sites More sharing options...
mLipok Posted February 3, 2016 Share Posted February 3, 2016 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:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 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 * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
madmega Posted February 3, 2016 Author Share Posted February 3, 2016 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 Link to comment Share on other sites More sharing options...
aa2zz6 Posted February 3, 2016 Share Posted February 3, 2016 Maybe include something to click the submit button: local $button = _IEGetObjByName ($oIE, "submit") $oBtn = _IEGetObjById($oIE, "submit") _IEAction($oBtn, "click") Link to comment Share on other sites More sharing options...
MuffinMan Posted February 3, 2016 Share Posted February 3, 2016 (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 February 3, 2016 by MuffinMan Adding details Link to comment Share on other sites More sharing options...
madmega Posted February 5, 2016 Author Share Posted February 5, 2016 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. expandcollapse popup#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) Link to comment Share on other sites More sharing options...
madmega Posted February 5, 2016 Author Share Posted February 5, 2016 (edited) Ah...i changed it to _IEFormSubmit($oForm, 0) and now it seems to work. Edited February 5, 2016 by madmega Link to comment Share on other sites More sharing options...
mLipok Posted February 5, 2016 Share Posted February 5, 2016 2 minutes ago, madmega said: But i am getting this error IEQuit(): undefined function. IEQuit or _IEQuit ?? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 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 * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
madmega Posted February 5, 2016 Author Share Posted February 5, 2016 Indeed it was a stupid typo, _IEQuit it was...but the whole script works !!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now