stevelach1 Posted January 29, 2010 Posted January 29, 2010 Hi all...Im new at autoit and need some help. I have been trying to get this to work on my own just so I can learn the program but just cant get to get this one part of the script to work. Im checking account to make sure there good..the main prob im having is having the script go though each line of the .txt file check the account and go to the next and do the same till EOF, but I can only get it to running the first line. Any help would be awsome .txt file formate is user|pass expandcollapse popup#include <File.au3> #include <IE.au3> Global $n = 1, $mail ,$pass,$line $oPageTitle = ("craigslist account - Microsoft Internet Explorer") $oIE = _IECreate ("https://accounts.craigslist.org/") $oForm = _IEGetObjByName($oIE,"login") $oUsername = _IEFormElementGetObjByName($oForm, "inputEmailHandle") $oPW = _IEFormElementGetObjByName($oForm, "inputPassword") $file = FileOpen("C:\accounts.txt", 0) ;Check to see if file is open if $file -1 Then msgBox(0x10, "Error", "Unable to open file.") Exit EndIf while 1 $line = FileReadLine($file,$n) if @error = -1 then ExitLoop If StringInStr($line, "|") Then $break = StringSplit($line, "|") $mail1 = StringReplace($break[1], " ", "") $pass1 = StringReplace($break[2], " ", "") EndIf _IEFormElementSetValue($oUsername,$mail1) _IEFormElementSetValue($oPW,$pass1) _IEFormSubmit($oForm) ;Sleep(5000) if _IELinkClickByText($oIE,"settings",0) then _IELinkClickByText($oIE,"log out") FileWrite("C:\Live.txt", $line & @CRLF) EndIf $n = $n + 1 WEnd FileClose($file) ;Sleep(5000)
water Posted January 29, 2010 Posted January 29, 2010 One problem I see is with variable $n. It's not defined and initialized to 1 so the line "$n = $n + 1" wont work. But actually you don't need it. Remove the linenumber ($n) from the FileReadLine statement and (according to the help file) it will read one line after the other starting with the first one. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
stevelach1 Posted January 29, 2010 Author Posted January 29, 2010 thanks...i did try to run this without the var $n but i still get the same results...just stops with the first record. i wounder if i have the while loop set up right. isn't it supposed to reload the script put in the next record and hit submit again with each new record till eof?
water Posted January 29, 2010 Posted January 29, 2010 Please insert #AutoIt3Wrapper_Run_Debug_Mode=y at the top of your script and you will see on the Scite console which statements of your script are executed. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
stevelach1 Posted January 29, 2010 Author Posted January 29, 2010 still no other ideas...i changed the while statment to check of page tile while in the loop but it still not working. i cant seem to find how to keep the script to keep checking while file ins not eof. im sure this is an easy fix but im stuck
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