Valuater Posted June 4, 2008 Share Posted June 4, 2008 Time to get this going again!!! Improve it if you want, but ...just use it, thats all Valuater 8 Link to comment Share on other sites More sharing options...
Coolw Posted June 4, 2008 Share Posted June 4, 2008 I get this error when trying to run this. CODEC:\Documents and Settings\David LaClair\Desktop\Test.au3(87,79) : WARNING: $WS_POPUP: possibly used before declaration. $Form = GUICreate("Rice Bot", $Width, $Height, -1, -1, BitOR($WS_POPUP, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\David LaClair\Desktop\Test.au3(87,91) : WARNING: $WS_BORDER: possibly used before declaration. $Form = GUICreate("Rice Bot", $Width, $Height, -1, -1, BitOR($WS_POPUP, $WS_BORDER) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\David LaClair\Desktop\Test.au3(87,79) : ERROR: $WS_POPUP: undeclared global variable. $Form = GUICreate("Rice Bot", $Width, $Height, -1, -1, BitOR($WS_POPUP, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\David LaClair\Desktop\Test.au3 - 1 error(s), 2 warning(s) When using this code... CODE#include <IE.au3> #include <INet.au3> #include <String.au3> #include <GUIConstants.au3> Global $Correct = 0, $False = 0, $First = 1, $Label, $Timerdiff, $Formtitle, $Minute = 0 $oIE = _IECreate("http://freerice.com", 1, 0) HotKeySet("{F10}", "hideshow") While 1 $Timer = TimerInit() $html = _IEBodyReadHTML($oIE) Check() $Word = StringRegExp($html, "(?i)<li><strong>(.*?)</strong>", 1) $LearnWord = StringRegExp($html, '(?i)incorrect>(.*?)</div>', 1) If IsArray($LearnWord) Then $splitted = StringSplit($LearnWord[0], "=") $learn = StringStripWS($splitted[1], 2) $means = StringStripWS($splitted[2], 1) ConsoleWrite(">Learned a new word!: " & $LearnWord[0] & @CRLF) IniWrite("learning.ini", "Learned words", $learn, $means) EndIf $isLearned = IniRead("learning.ini", "Learned words", StringStripWS($Word[0], 8), "") If $isLearned <> "" Then ConsoleWrite("+>Found synonym. Clicking by text(learned word): " & $isLearned & @CRLF) _IELinkClickByText($oIE, $isLearned) Else $SynonymsG = _GetSyn(StringStripWS($Word[0], 8)) If IsArray($SynonymsG) Then $oLinks = _IELinkGetCollection($oIE) $Found = False For $oLink In $oLinks For $a = 1 To $SynonymsG[0] If StringInStr($oLink.href, "Javascript") Then $test = _IEPropertyGet($oLink, "innertext") If StringInStr($SynonymsG[$a], $test) Then $WordToClick = $test $Found = True ExitLoop (2) EndIf EndIf Next Next Else $Found = False EndIf If $Found Then ConsoleWrite("+>Found synonym. Clicking by text: " & $WordToClick & @CRLF) _IELinkClickByText($oIE, $WordToClick) Else ConsoleWrite("-> Could not find synonym. Clicking random word." & @CRLF) _IENavigate($oIE, "java script: submitForm('" & Random(1, 4, 1) & "')") EndIf EndIf Sleep(1000) $Timerdiff += TimerDiff($Timer) $Second = Round($Timerdiff / 1000, 0) If $Second >= 60 Then $Second = 0 $Minute += 1 $Timerdiff = 0 EndIf GUICtrlSetData($Formtitle, " Rice Bot - Minute: " & $Minute & " Second: " & $Second) WEnd Func hideshow() If _IEPropertyGet($oIE, "visible") Then _IEAction($oIE, "invisible") Else _IEAction($oIE, "visible") EndIf EndFunc ;==>hideshow Func _GetSyn($sWord) $sSource = _INetGetSource("http://www.synonymer.se/en/?query=" & $sWord & "&btnS=Find+synonyms") $synonyms = StringRegExp($sSource, '(?i)class="synonym">(.*?)</TR>', 1) If Not IsArray($synonyms) Then Return 0 $syns = StringSplit($synonyms[0], ",") Return $syns EndFunc ;==>_GetSyn Func Check() If $First = 1 Then _IEAction($oIE, "invisible") $Width = 270 $Height = 55 $Form = GUICreate("Rice Bot", $Width, $Height, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) $Formtitle = GUICtrlCreateLabel(" Rice Bot", 0, 4, @DesktopWidth, 20, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Formtitlebackground = GUICtrlCreateGraphic(0, 0, @DesktopWidth, 22) GUICtrlSetBkColor(-1, 0x000000) $Label = GUICtrlCreateLabel("", 8, 25, $Width, 50) GUISetState() WinSetTrans($Form, "", 200) $First = 0 EndIf $Amount = _StringBetween($html, '<P id=donatedAmount>', '</P>') If IsArray($Amount) Then $Amount2 = StringRegExp($Amount[0], "[[:digit:]]+", 1) If Not @error Then If StringInStr($html, '<div id=correct>CORRECT!</div>') Then $Correct += 1 Else $False += 1 EndIf GUICtrlSetData($Label, "You have now donated " & $Amount2[0] & " grains of rice." & @CRLF & "Correct : " & $Correct & " False : " & $False & " Correct Percentage : " & Round((($Correct / ($Correct + $False)) * 100), 0) & "%") EndIf EndIf EndFunc ;==>Check And yes, I did fix the javascript error thing My ProgramsMy WIP'sSteam Server Restarter Link to comment Share on other sites More sharing options...
Regency Posted June 4, 2008 Share Posted June 4, 2008 I also get a $wS_pop error.. what include is that with? Link to comment Share on other sites More sharing options...
Coolw Posted June 4, 2008 Share Posted June 4, 2008 (edited) I also get a $wS_pop error.. what include is that with?I figured, if you goto the error spot, just remove that end part, the whole Bitor part, it still works $Form = GUICreate("Rice Bot", $Width, $Height, -1, -1, BitOR($WS_POPUP, $WS_BORDER))should be$Form = GUICreate("Rice Bot", $Width, $Height, -1, -1) Edited June 4, 2008 by Coolw My ProgramsMy WIP'sSteam Server Restarter Link to comment Share on other sites More sharing options...
Valuater Posted June 4, 2008 Share Posted June 4, 2008 Thats part of Autoit 3.2.12.0 Just use #Include <WindowsConstants.au3> at the top 8) Link to comment Share on other sites More sharing options...
Regency Posted June 4, 2008 Share Posted June 4, 2008 I HAVE read this whole post.. Yet i still come up with this error.. it runs for a few min then this error pops up.. But now its comming up even before it runs.. Any ideas? C:\Documents and Settings\ScorpiA Regency\Desktop\Free Rice\Freerice2.au3 (25) : ==> Subscript used with non-Array variable.: $isLearned = IniRead("learning.ini", "Learned words", StringStripWS($Word[0], 8), "") $isLearned = IniRead("learning.ini", "Learned words", StringStripWS($Word^ ERROR ->18:50:09 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 2.735 expandcollapse popup#include <IE.au3> #include <INet.au3> #include <String.au3> #include <GUIConstants.au3> #Include <WindowsConstants.au3> Global $Correct = 0, $False = 0, $First = 1, $Label, $Timerdiff, $Formtitle, $Minute = 0 $oIE = _IECreate("http://freerice.com", 1, 0) HotKeySet("{F10}", "hideshow") While 1 $Timer = TimerInit() $html = _IEBodyReadHTML($oIE) Check() Sleep(1000) $Word = StringRegExp($html, "(?i)<li><strong>(.*?)</strong>", 1) $LearnWord = StringRegExp($html, '(?i)incorrect>(.*?)</div>', 1) If IsArray($LearnWord) Then $splitted = StringSplit($LearnWord[0], "=") $learn = StringStripWS($splitted[1], 2) $means = StringStripWS($splitted[2], 1) ConsoleWrite(">Learned a new word!: " & $LearnWord[0] & @CRLF) IniWrite("learning.ini", "Learned words", $learn, $means) EndIf $isLearned = IniRead("learning.ini", "Learned words", StringStripWS($Word[0], 8), "") If $isLearned <> "" Then ConsoleWrite("+>Found synonym. Clicking by text(learned word): " & $isLearned & @CRLF) _IELinkClickByText($oIE, $isLearned) Else $SynonymsG = _GetSyn(StringStripWS($Word[0], 8)) If IsArray($SynonymsG) Then $oLinks = _IELinkGetCollection($oIE) $Found = False For $oLink In $oLinks For $a = 1 To $SynonymsG[0] If StringInStr($oLink.href, "Javascript") Then $test = _IEPropertyGet($oLink, "innertext") If StringInStr($SynonymsG[$a], $test) Then $WordToClick = $test $Found = True ExitLoop (2) EndIf EndIf Next Next Else $Found = False EndIf If $Found Then ConsoleWrite("+>Found synonym. Clicking by text: " & $WordToClick & @CRLF) _IELinkClickByText($oIE, $WordToClick) Else ConsoleWrite("-> Could not find synonym. Clicking random word." & @CRLF) _IENavigate($oIE, "java script: submitForm('" & Random(1, 4, 1) & "')") EndIf EndIf Sleep(1000) $Timerdiff += TimerDiff($Timer) $Second = Round($Timerdiff / 1000, 0) If $Second >= 60 Then $Second = 0 $Minute += 1 $Timerdiff = 0 EndIf GUICtrlSetData($Formtitle, " Rice Bot - Minute: " & $Minute & " Second: " & $Second) WEnd Func hideshow() If _IEPropertyGet($oIE, "visible") Then _IEAction($oIE, "invisible") Else _IEAction($oIE, "visible") EndIf EndFunc ;==>hideshow Func _GetSyn($sWord) $sSource = _INetGetSource("http://www.synonymer.se/en/?query=" & $sWord & "&btnS=Find+synonyms") $synonyms = StringRegExp($sSource, '(?i)class="synonym">(.*?)</TR>', 1) If Not IsArray($synonyms) Then Return 0 $syns = StringSplit($synonyms[0], ",") Return $syns EndFunc ;==>_GetSyn Func Check() If $First = 1 Then _IEAction($oIE, "invisible") $Width = 270 $Height = 55 $Form = GUICreate("Rice Bot", $Width, $Height, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) $Formtitle = GUICtrlCreateLabel(" Rice Bot", 0, 4, @DesktopWidth, 20, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Formtitlebackground = GUICtrlCreateGraphic(0, 0, @DesktopWidth, 22) GUICtrlSetBkColor(-1, 0x000000) $Label = GUICtrlCreateLabel("", 8, 25, $Width, 50) GUISetState() WinSetTrans($Form, "", 200) $First = 0 EndIf $Amount = _StringBetween($html, '<P id=donatedAmount>', '</P>') If IsArray($Amount) Then $Amount2 = StringRegExp($Amount[0], "[[:digit:]]+", 1) If Not @error Then If StringInStr($html, '<div id=correct>CORRECT!</div>') Then $Correct += 1 Else $False += 1 EndIf GUICtrlSetData($Label, "You have now donated " & $Amount2[0] & " grains of rice." & @CRLF & "Correct : " & $Correct & " False : " & $False & " Correct Percentage : " & Round((($Correct / ($Correct + $False)) * 100), 0) & "%") EndIf EndIf EndFunc ;==>Check What am i doing wrong? Link to comment Share on other sites More sharing options...
Valuater Posted June 4, 2008 Share Posted June 4, 2008 did you download the ini file and place it in the location as stated in the script??? 8) Link to comment Share on other sites More sharing options...
Regency Posted June 4, 2008 Share Posted June 4, 2008 Yeppers... But thanks.. I think i got it to work, (closed the iexplorer process.. dunno why but its working Link to comment Share on other sites More sharing options...
Kyme Posted June 6, 2008 Share Posted June 6, 2008 i have some problem whit this bot...when random word start i got this in my autoit console -> Could not find synonym. Clicking random word. C:\Documents and Settings\The_Kymy\Desktop\bot.au3 (23) : ==> Subscript used with non-Array variable.: $isLearned = IniRead("learning.ini", "Learned words", StringStripWS($Word[0], 8), "") $isLearned = IniRead("learning.ini", "Learned words", StringStripWS($Word^ ERROR >Exit code: 1 Time: 60.192 how i can fix it??? Link to comment Share on other sites More sharing options...
LongBowNZ Posted June 6, 2008 Share Posted June 6, 2008 (edited) Botting a charity website is just sad, I suggest this topic be deleted its not doing anyone any good. Edited June 6, 2008 by LongBowNZ Link to comment Share on other sites More sharing options...
Zed Posted June 6, 2008 Share Posted June 6, 2008 Hm yea, just do it "moderately". If you over do it, the sponsor will not support the site anymore. Link to comment Share on other sites More sharing options...
LongBowNZ Posted June 6, 2008 Share Posted June 6, 2008 How do you judge moderately though. You can't control how many and how long people use the bot. Link to comment Share on other sites More sharing options...
damian666 Posted June 6, 2008 Share Posted June 6, 2008 (edited) can someone help me with this piece of code from the bot? $Amount = _StringBetween($html, '<P id=donatedAmount>', '</P>') If IsArray($Amount) Then $Amount2 = StringRegExp($Amount[0], "[[:digit:]]+", 1) If Not @error Then If StringInStr($html, '<div id=correct>CORRECT!</div>') Then $Correct += 1 Else $False += 1 EndIf GUICtrlSetData($Label, "You have now donated " & $Amount2[0] & " grains of rice." & @CRLF & "Correct : " Correct & " False : " & $False & " Correct Percentage : " & Round((($Correct / ($Correct + $False)) * 100), 0) & "%")& EndIf EndIf i want to include it in a script of my own, but i cant get it to work... i did this $Amount = _StringBetween($html, '<SPAN class=style3>', ''Move(s) Remaining</SPAN>') If IsArray($Amount) Then $Amount2 = StringRegExp($Amount[0], "[[:digit:]]+", 1) If Not @error Then If StringInStr($html, '<div id=correct>CORRECT!</div>') Then $Correct += 1 Else $False += 1 EndIf GUICtrlSetData($Label, "You have " & $Amount2[0] & " moves left.") EndIf EndIf any help is welcome Damian666 Edited June 6, 2008 by damian666 and proud of it!!! Link to comment Share on other sites More sharing options...
damian666 Posted June 6, 2008 Share Posted June 6, 2008 oh, btw, the thing that doesnt work, is i dont get to see anything, no numbers nothing. so it wont read the string between those two strings for some reason. i did check if teh html was read, and it was... :S Damian666 and proud of it!!! Link to comment Share on other sites More sharing options...
HypercamJ Posted June 19, 2008 Share Posted June 19, 2008 (edited) Works nicely! By the way, added a delay that works very nice! (Hasn't froze up so far: half an hour) ConsoleWrite(">Learned a new word!: " & $LearnWord[0] & @CRLF) IniWrite("learning.ini", "Learned words", $learn, $means) EndIf $isLearned = IniRead("learning.ini", "Learned words", StringStripWS($Word[0], 8), "") sleep (500) If $isLearned <> "" Then ConsoleWrite("+>Found synonym. Clicking by text(learned word): " & $isLearned & @CRLF Add sleep (500) between $isLearned and If $isLearned. It pauses the script long enough to let the server catch up. Edited June 19, 2008 by HypercamJ Prove, and I will believe... Link to comment Share on other sites More sharing options...
TehWhale Posted June 20, 2008 Share Posted June 20, 2008 Ran this bot overnight, had no issues, and donated 45k. Link to comment Share on other sites More sharing options...
NELyon Posted June 20, 2008 Share Posted June 20, 2008 Ran this bot overnight, had no issues, and donated 45k.No, you stole 45k.The website pays for the rice by displaying advertisements to the client. If you are using a bot, then nobody is seeing the advertisements. Link to comment Share on other sites More sharing options...
TehWhale Posted June 20, 2008 Share Posted June 20, 2008 No, you stole 45k.The website pays for the rice by displaying advertisements to the client. If you are using a bot, then nobody is seeing the advertisements.Technically, the bot has the window hidden but im looking at them without seeing them. Link to comment Share on other sites More sharing options...
NELyon Posted June 20, 2008 Share Posted June 20, 2008 Technically, the bot has the window hidden but im looking at them without seeing them.Contradictory statement. Link to comment Share on other sites More sharing options...
TehWhale Posted June 20, 2008 Share Posted June 20, 2008 Contradictory statement.No...The bot is seeing the Advert's, but the Advert's don't know that it's a bot. I see no harm. Link to comment Share on other sites More sharing options...
Recommended Posts