KieuBang Posted April 12, 2008 Share Posted April 12, 2008 (edited) Hi everyone! I am having problem with my program, I want to code program, It load values from text file and then fill the form. Here is my code #include <IE.au3> #include <File.au3> #include <Array.au3> #include <GUIConstants.au3> $count=0 GUICreate("Auto Registration", 320, 240, @DesktopWidth/2-160, @DesktopHeight/2-150) GuiCtrlCreateLabel("text File: ", 10, 5, 140, 20) $txtFile = GUICtrlCreateInput ( "file.txt", 160, 5, 150, 20) GuiCtrlCreateLabel("Split Char: ", 10, 35, 140, 20) $split_char = GUICtrlCreateInput ( "/", 160, 35, 150, 20) GuiCtrlCreateLabel("Full Name: ", 10, 65, 140, 20) $fullname = GUICtrlCreateInput ( "4", 160, 65, 150, 20) GuiCtrlCreateLabel("Email: ", 10, 95, 140, 20) $email = GUICtrlCreateInput ( "8", 160, 95, 150, 20) GuiCtrlCreateLabel("Password: ", 10, 125, 140, 20) $password = GUICtrlCreateInput ( "9", 160, 125, 150, 20) GuiCtrlCreateLabel("re-Password: ", 10, 155, 140, 20) $repassword = GUICtrlCreateInput ( "11", 160, 155, 150, 20) $btn = GUICtrlCreateButton ("Begin!", 100, 200, 120, 20) ;============================================================================================== GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $btn msgbox(0,"","Ready?") Start() Case $msg = $GUI_EVENT_CLOSE ;Destroy the GUI including the controls GUIDelete() ;Exit the script Exit EndSelect WEnd Func Start() $txtFile = GUICtrlRead($txtFile) $split_char = GUICtrlRead($split_char) $fullname = GUICtrlRead($fullname) $email = GUICtrlRead($email) $password = GUICtrlRead($password) $repassword = GUICtrlRead($repassword) $valid_acct = $txtFile & "_ok.txt" $invalid_acct = $txtFile & "_die.txt" Const $start="http://website" $oIE = _IECreate ($start,1) $text_file = FileOpen($txtFile, 0) If $text_file = -1 Then MsgBox(0, $txtFile, "File not OPEN! ") Exit EndIf While 1 $line = FileReadLine($text_file) $count+=1 TrayTip("Doing", $count, 5) If @error = -1 Then ExitLoop If StringLen($line) > 4 then $this_line = StringSplit(StringReplace($line, $split_char, @LF), @LF) $fullname = $this_line[$fullname] $repassword = $this_line[$repassword] $email = $this_line[$email] $oForm = _IEFormGetObjByName ($oIE, "mainForm") $oQuery = _IEFormElementGetObjByName ($oForm, "fullname") _IEFormElementSetValue ($oQuery, $fullname) $oQuery = _IEFormElementGetObjByName ($oForm, "email") _IEFormElementSetValue ($oQuery, $email) $oQuery = _IEFormElementGetObjByName ($oForm, "password") _IEFormElementSetValue ($oQuery, $password) $oQuery = _IEFormElementGetObjByName ($oForm, "repassword") _IEFormElementSetValue ($oQuery, $repassword) _IEFormSubmit ($oForm) $dat = _IEBodyReadHTML ($oIE) $pos_inv = StringInStr($dat, "Password too short",0,1); ;///////////////Invalid <<<<<<<< This working OK If($pos_inv>0) then $invalid_acct1 = FileOpen($invalid_acct, 1) If $invalid_acct1 = -1 Then MsgBox(0, $invalid_acct, "File not OPEN! ") Exit EndIf FileWriteLine($invalid_acct1, $line) FileClose($invalid_acct1) ;///////////////Accept <<<<<<<< HELP ME THIS. Else $valid_acct1 = FileOpen($valid_acct, 1) If $valid_acct1 = -1 Then MsgBox(0, $valid_acct, "File not OPEN! ") Exit EndIf FileWriteLine($valid_acct1, $line) FileClose($valid_acct1) sleep (5000) _IEAction($oIE,"back") EndIf EndIf WEnd EndFuncThe process: After the form submit if the fields not correct or field blank it will fill another values from next line of text file. If fields are correct it will redirect to another page, I want it back to form when it redirected to another page to continue refill form. I used _IEAction($oIE,"back") but it goes back to the first page (Home Page) . Please some one can helo me complete it. Thank for reading my topic. Edited April 12, 2008 by KieuBang Link to comment Share on other sites More sharing options...
DaleHohm Posted April 12, 2008 Share Posted April 12, 2008 Sorry, looks like code trying to crack into a website. Not something I will help with. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
KieuBang Posted April 12, 2008 Author Share Posted April 12, 2008 Some one please help me with this . Link to comment Share on other sites More sharing options...
DaleHohm Posted April 13, 2008 Share Posted April 13, 2008 Why? Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble 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