voidale Posted February 26, 2010 Posted February 26, 2010 (edited) Hey guys, i looked at the old scripts before opening this no luck and they don't work anymore i hope you don't mind helping me out creating a quick bot ok so I want to create a bot that login to my facebook account takes user+pass from txt file (what would be better email:pass txt file or 2x txt 1 for user 1 for pass?) I'm not sure how to read half line "email:pass" and it's too much work so finally we are logged in I need it to go to "http://www.facebook.com/editpicture.php" that's the easy part, harder part to make it click browse and choose the picture ;> this is what i got so far if you guys know how to do it or script examples everything is welcome many thanks #include<IE.au3> #include <File.au3> Local $mailtxt = "mail.txt" Local $passtxt = "pass.txt" $Mail = $mailtxt $Pass = $passtxt $oIE = _IECreate("https://login.facebook.com/login.php?login_attempt=1", 0, 1, 1) $oForm = _IEFormGetObjByName($oIE, "loginform") $oQuery = _IEFormElementGetObjByName($oForm, "email") $o_Query = _IEFormElementGetObjByName($oForm, "pass") $oSubmit = _IEFormElementGetObjByName($oForm, "doquicklogin") _IEFormElementSetValue($oQuery, $Mail) _IEFormElementSetValue($o_Query, $Pass) _IEAction($oSubmit, "click") this will give me this error --> IE.au3 V2.4-0 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch --> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType" this is old script for objbyname and I have never used it and i can't really understand the source file and how to modify. thanks again for any help =] Edited February 26, 2010 by voidale
Steveiwonder Posted February 26, 2010 Posted February 26, 2010 (edited) You know you need to look at the HTML code and get names of form elements right? Your script does not have the correct names. #include<IE.au3> #include <File.au3> Local $mailtxt = "mail.txt" Local $passtxt = "pass.txt" $Mail = $mailtxt $Pass = $passtxt $oIE = _IECreate("https://login.facebook.com/login.php?login_attempt=1", 0, 1, 1) $oForm = _IEFormGetObjByName($oIE, "login_form") $oQuery = _IEFormElementGetObjByName($oForm, "email") $o_Query = _IEFormElementGetObjByName($oForm, "pass") $oSubmit = _IEFormElementGetObjByName($oForm, "login") _IEFormElementSetValue($oQuery, $Mail) _IEFormElementSetValue($o_Query, $Pass) _IEAction($oSubmit, "click") That will work. Steveiwonder Edited February 26, 2010 by Steveiwonder They call me MrRegExpMan
voidale Posted February 26, 2010 Author Posted February 26, 2010 You know you need to look at the HTML code and get names of form elements right? Your script does not have the correct names. #include<IE.au3> #include <File.au3> Local $mailtxt = "mail.txt" Local $passtxt = "pass.txt" $Mail = $mailtxt $Pass = $passtxt $oIE = _IECreate("https://login.facebook.com/login.php?login_attempt=1", 0, 1, 1) $oForm = _IEFormGetObjByName($oIE, "login_form") $oQuery = _IEFormElementGetObjByName($oForm, "email") $o_Query = _IEFormElementGetObjByName($oForm, "pass") $oSubmit = _IEFormElementGetObjByName($oForm, "login") _IEFormElementSetValue($oQuery, $Mail) _IEFormElementSetValue($o_Query, $Pass) _IEAction($oSubmit, "click") That will work. Steveiwonder Yes it works thanks alot, I'm trying to make it read the line from 1 txt file like "email:pass" so it will read email and stop at : and for pass start from : I'm stuck #include<IE.au3> #include<File.au3> Local $Sourcefile = "userpass.txt" Local $aFileLines[2] For $i = 1 To 1 $read = FileReadLine($Sourcefile,$i) $aFileLines[$i] = $read Next $Mail = $read $Pass = $read $oIE = _IECreate("https://login.facebook.com/login.php?login_attempt=1", 0, 1, 1) $oForm = _IEFormGetObjByName($oIE, "login_form") $oQuery = _IEFormElementGetObjByName($oForm, "email") $o_Query = _IEFormElementGetObjByName($oForm, "pass") $oSubmit = _IEFormElementGetObjByName($oForm, "login") _IEFormElementSetValue($oQuery, $Mail) _IEFormElementSetValue($o_Query, $Pass) _IEAction($oSubmit, "click") any ideas?
Steveiwonder Posted February 26, 2010 Posted February 26, 2010 Take a look in the helpfile @ FileReadLine - If your still stuck after that post your examples that you have tried and we'll be happy to help mate. Steveiwonder They call me MrRegExpMan
voidale Posted February 27, 2010 Author Posted February 27, 2010 Take a look in the helpfile @ FileReadLine - If your still stuck after that post your examples that you have tried and we'll be happy to help mate.Steveiwonderthe post above has filereadline stuck there
JohnOne Posted February 27, 2010 Posted February 27, 2010 You need to use StringSplit() eg. $sString = "email@email.com:Password" $aRtn = StringSplit($sString,":",2) If IsArray($aRtn) Then Msgbox(0,"Return","Email = " & $aRtn[0] & @CRLF & "Password = " & $aRtn[1]) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
voidale Posted February 27, 2010 Author Posted February 27, 2010 (edited) You need to use StringSplit() eg. $sString = "email@email.com:Password" $aRtn = StringSplit($sString,":",2) If IsArray($aRtn) Then Msgbox(0,"Return","Email = " & $aRtn[0] & @CRLF & "Password = " & $aRtn[1]) this code works great thanks got another issue now this code to upload a pic to facebook, even the example won't work for IE8 #include <IE.au3> $oIE = _IE_Example("form") $oForm = _IEFormGetObjByName($oIE, "ExampleForm") $oInputFile = _IEFormElementGetObjByName($oForm, "fileExample") ; Assign input focus to the field and then send the text string _IEAction($oInputFile, "focus") Send("C:\myfile.txt") found a new code $ie.Navigate("file: ///L:/miniedit_tst3.htm") $ie.Visible=1 Sleep(1024) ;wait for full load inputfile('champinput','C:\fichier.dat') Exit Func inputfile($id,$filename) $ie.Navigate("javascript: document.getElementById('"& $id &"').click();") Sleep(1024) ;wait depend of computer's speed Send($filename) ;Sleep(1024) ;wait only for user see the filename sended Send("{ENTER}") EndFunc But I cant understand the new code, anyone has a code for IE8 for <input type='file' Edited February 27, 2010 by voidale
voidale Posted February 28, 2010 Author Posted February 28, 2010 You need to use StringSplit() eg. $sString = "email@email.com:Password" $aRtn = StringSplit($sString,":",2) If IsArray($aRtn) Then Msgbox(0,"Return","Email = " & $aRtn[0] & @CRLF & "Password = " & $aRtn[1]) ok so it worked but when i try to use it as this it won't work, i get Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $strValue = $aRtn[2] & ":" & $aRtn[3] $strValue = ^ ERROR here is the code #include<IE.au3> #include<File.au3> Local $Source = "userpass.txt" Local $aFileLines[2] For $i = 1 To 1 $read = FileReadLine($Source, $i) $aFileLines[$i] = $read Next $sString = $read $aRtn = StringSplit($sString, ":", 2) Const $HKEY_CURRENT_USER = 0x80000001 $strComputer = "." $objRegistry = ObjGet("winmgmts:\\" & $strComputer & "\root\default:StdRegProv") $strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" $strValueName = "ProxyEnable" $dwValue = 1 $objRegistry.SetDWORDValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $dwValue) $strValueName = "ProxyServer" $strValue = $aRtn[2] & ":" & $aRtn[3] $objRegistry.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $strValue) $strValueName = "ProxyOverride" $strValue = "<local>" $objRegistry.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $strValue) I have searched the forum for every possible way what i understand is i need unbound or for x = 1 or something but I can't make it work i tried basicly what it does takes the the proxy and port from the txt file that look like example:example:proxy:port:example:example Please help! p.s sometimes the script works with out the error but when i add another $aRtn[0-6] i get the array error
voidale Posted February 28, 2010 Author Posted February 28, 2010 anyone please this is the only thing that left and I'm done sucks I'm done with the script and the only thing hold me back is an error i have no clue about ;/ check post above
JohnOne Posted February 28, 2010 Posted February 28, 2010 Stringsplit returns a 2 element array [0] and [1] I dont know where you are getting [2] and [3] from, and that is your error. I dont understand the rest of the code you posted, but that error is because the array does not have the elements you asked for. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
voidale Posted February 28, 2010 Author Posted February 28, 2010 (edited) Stringsplit returns a 2 element array [0] and [1] I dont know where you are getting [2] and [3] from, and that is your error. I dont understand the rest of the code you posted, but that error is because the array does not have the elements you asked for. lol thats weird i i used [2] and [3] and when i run a test it worked but now as the code became bigger it won't my txt file looks example:example:[2]:[3]:example the array does not have the elements i asked for how can i have them? i want to be able to use $aRtn[0] $aRtn[1] $aRtn[2] $aRtn[3] $aRtn[4] $aRtn[5] the same way as $aRtn[0] and $aRtn[1] you made p.s it's just 1 line at the txt file Edited February 28, 2010 by voidale
JohnOne Posted February 28, 2010 Posted February 28, 2010 If its just one line then test it with something like this #include <Array.au3> $sString = "email@email1.com:Password1:email@email2.com:Password2:email@email3.com:Password3" $aRtn = StringSplit($sString,":",2) If IsArray($aRtn) Then _ArrayDisplay($aRtn) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
voidale Posted February 28, 2010 Author Posted February 28, 2010 (edited) If its just one line then test it with something like this #include <Array.au3> $sString = "email@email1.com:Password1:email@email2.com:Password2:email@email3.com:Password3" $aRtn = StringSplit($sString,":",2) If IsArray($aRtn) Then _ArrayDisplay($aRtn) this would be the same as i use #include<IE.au3> #include<File.au3> #include<Array.au3> Local $Source = "userpass.txt" Local $aFileLines[2] For $i = 1 To 1 $read = FileReadLine($Source, $i) $aFileLines[$i] = $read Next $sString = $read $aRtn = StringSplit($sString, ":", 2) I'm using txt file and having the error Edited February 28, 2010 by voidale
JohnOne Posted February 28, 2010 Posted February 28, 2010 give an example of your text file AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
voidale Posted February 28, 2010 Author Posted February 28, 2010 give an example of your text file email@gmail.com:123456789:99.55.44.19:8080:jonlock:2rgRMb56b
JohnOne Posted February 28, 2010 Posted February 28, 2010 And that is the whole of your text file ? ie just one line? And you only have 1 email and password in it ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
voidale Posted February 28, 2010 Author Posted February 28, 2010 And that is the whole of your text file ?ie just one line?And you only have 1 email and password in it ?yes just 1 lineit's email:pass:proxyip:port:proxyuser:proxypass
JohnOne Posted February 28, 2010 Posted February 28, 2010 works for me with that string, but email and password are still [0] and [1], which if I remember correctly is what you need to login to facebook. If you consolewrite the string from text file, does it appear correctly ? perhaps you have to open the file first (although I dont think so) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
voidale Posted February 28, 2010 Author Posted February 28, 2010 works for me with that string, but email and password are still [0] and [1], which if I remember correctly is what you need to login to facebook. If you consolewrite the string from text file, does it appear correctly ? perhaps you have to open the file first (although I dont think so) i dunno how to use consolewrite, but i used msg box and it appears fine but when you use a code just like this one #include<IE.au3> #include<File.au3> Local $Source = "userpass.txt" Local $aFileLines[2] For $i = 1 To 1 $read = FileReadLine($Source, $i) $aFileLines[$i] = $read Next $sString = $read $aRtn = StringSplit($sString, ":", 2) Const $HKEY_CURRENT_USER = 0x80000001 $strComputer = "." $objRegistry = ObjGet("winmgmts:\\" & $strComputer & "\root\default:StdRegProv") $strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" $strValueName = "ProxyEnable" $dwValue = 1 $objRegistry.SetDWORDValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $dwValue) $strValueName = "ProxyServer" $strValue = $aRtn[2] & ":" & $aRtn[3] $objRegistry.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $strValue) $strValueName = "ProxyOverride" $strValue = "<local>" $objRegistry.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $strValue) this will change the proxy, it will give the error is there a way to copy $aRtn[2] and [3] to some other file or array and then use it to the proxy options it seems like the script is confused or something lol
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