aeau2080 Posted May 31, 2009 Share Posted May 31, 2009 i have a program that backup my files and upload it to gmail accounts.... and i need many gmail accounts so i am trying to make this macro to semi-automatically creates gmail accounts (of course i have to enter the capchars)... 1- i created a file namelist.txt with the logins i want to create one per line 2- i created a file password.txt with the password i will use with all the accounts 3- i created a file created acccounts.txt to save the created accounts to it 4- i have been working on it for a couple of days with the help of the user oMBRa on this forums, the help file and google 5- after many rewrites and retries i got it to work but not as it should expandcollapse popup#include <IE.au3> #include <File.au3> #include <Array.au3> while 1 ;Remove IE cookies RunWait(@SystemDir & "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2") ;Open gmail registration page $oIE = _IECreate("http://mail.google.com/mail/signup") $oForm = _IEFormGetObjByName($oIE, "createaccount") $title = WinGetTitle("Windows Internet Explorer") While $title = "Google Accounts" ;Open Password.txt for reading and read the first line and copy it to clipboard as the password $PassswordFile = FileOpen(@ScriptDir & "\Password.txt", 0) $Password = FileReadLine($PassswordFile, 1) ;if the password.txt file is empty display a message While $Password = "" FileClose(@ScriptDir & "\Password.txt") MsgBox(262144, "Password.txt is empty !", "Password.txt is empty, Please add a password to be used with all accounts then click OK...") WEnd ClipPut($Password) ;paste the pssword into the password and re-enter password fields $oPasswd = _IEFormElementGetObjByName($oForm, "Passwd") _IEFormElementSetValue($oPasswd, ClipGet()) $oPasswdAgain = _IEFormElementGetObjByName($oForm, "PasswdAgain") _IEFormElementSetValue($oPasswdAgain, ClipGet()) FileClose(@ScriptDir & "\Password.txt") ;Open NameList.txt in reading mode and read the first line and copy it to clipboard as the username and and paste that username to the fileds firstname, lastname and username $NameList = FileOpen(@ScriptDir & "\NameList.txt", 0) $Username = FileReadLine($NameList, 1) ;if the namelist.txt file is empty display a message While $Username = "" FileClose(@ScriptDir & "\NameList.txt") MsgBox(262144, "NameList.txt is empty !", "NameList.txt is empty, Please add a list of desired usernames then click OK...") $NameList = FileOpen(@ScriptDir & "\NameList.txt", 0) $Username = FileReadLine($NameList, 1) WEnd ClipPut($Username) $oFirstName = _IEFormElementGetObjByName($oForm, "FirstName") _IEFormElementSetValue($oFirstName, ClipGet()) $oLastName = _IEFormElementGetObjByName($oForm, "LastName") _IEFormElementSetValue($oLastName, ClipGet()) $oEmail = _IEFormElementGetObjByName($oForm, "Email") _IEFormElementSetValue($oEmail, ClipGet()) ;reopen NameList.txt in writing mode and replace the first line with a blank line FileClose(@ScriptDir & "\NameList.txt") FileOpen(@ScriptDir & "\NameList.txt", 1) $find = ClipGet() $replace = "" $Replacing = (@ScriptDir & "\NameList.txt") _ReplaceStringInFile($Replacing, $find, $replace) ;remove blank lines from NameList.txt Dim $sText = FileRead(@ScriptDir & "\NameList.txt") $sText = StringRegExpReplace($sText, '(?m)^(\r\n)', '') Dim $hFile = FileOpen(@ScriptDir & "\NameList.txt", 2) FileWrite($hFile, $sText) FileClose($hFile) ;Uncheck both remmember me and web history checkboxes _IEFormElementCheckBoxSelect($oForm, 0, "PersistentCookie", 0, "byIndex") _IEFormElementCheckBoxSelect($oForm, 0, "smhck", 0, "byIndex") ;Select the password reminder question as "What is your primary frequent flyer number" from the drop-down menu $oSelection = _IEFormElementGetObjByName($oForm, "Selection") _IEFormElementSetValue($oSelection, "What is your primary frequent flyer number") $oIdentityAnswer = _IEFormElementGetObjByName($oForm, "IdentityAnswer") ;Enter the secret answer as "passreminder" _IEFormElementSetValue($oIdentityAnswer, "passreminder") ;Select location as "Unites States" from the drop-down menu $oLoc = _IEFormElementGetObjByName($oForm, "Loc") _IEFormElementSetValue($oLoc, "US") ;Activate the IE window & Focus on the enter CAPTCHA WinActivate("Google Accounts - Windows Internet Explorer") $oNewAccountCaptcha = _IEFormElementGetObjByName($oForm, "NewAccountCaptcha") _IEAction($oNewAccountCaptcha, "focus") ;Message to enter the CAPTCHA then click ok to submit the form MsgBox(262144, "CAPTCHA", "Please input CAPTCHA now then click OK to continue...") _IEFormSubmit($oForm) _IELoadWait($oIE) $title = WinGetTitle("Windows Internet Explorer") WEnd ;Add successfully created accounts to CreatedAccounts.txt If $title = "Gmail: Introduction" Then $CreatedAccounts = FileOpen(@ScriptDir & "\CreatedAccounts.txt", 1) FileWriteLine($CreatedAccounts, ClipGet() & "@gmail.com") FileClose($CreatedAccounts) Else EndIf _IEQuit($oIE) WEnd "i know the code is a mess but that's the best i could do as a n00b" the problems are 1- if the username is already taken it should reset the value to the next username and re enter the password...but it does not the username is still the same and the password field is empty... it seems like a problem with the multilevel while loops... Link to comment Share on other sites More sharing options...
Roman9 Posted May 31, 2009 Share Posted May 31, 2009 Where you have $Username = FileReadLine($NameList, 1) Replace it with $Username = FileReadLine($NameList, $line) $line+=1 And don't forget to add Global $line = 1 at the top of your script. Link to comment Share on other sites More sharing options...
aeau2080 Posted May 31, 2009 Author Share Posted May 31, 2009 thanks roman9 but it didn't help ... still the same problem... 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