.M!x Posted June 25, 2006 Posted June 25, 2006 Hello, I recently found a script someone else was working on that I decided to fix up. The script is supposed to autonomously browse a forum type website. The only change I've made is deleting the random chance of visiting a certain section of this website because the directories and layout had changed since the script was created. The problem I'm having is that it's supposed to enter a url with a random value and go to that page, then wait for a while and enter another random url. What's happening is it will enter the same url and basically refresh the page several times before putting a new url in. It's definately not a coincedence because thousands of combinations are possible. can someone look at the script and tell me what I can do to fix this? Here's what the script looks like: expandcollapse popup;*****set autoit options************ opt("MustDeclareVars", 0) opt("WinTitleMatchMode", 1) Opt("SendKeyDelay", 0) ;********************set functions************** $activ=1 Func checkactiv() WinActive ("Gaia") $activ = WinWaitActive("Gaia", "", 9) While $activ=0 WinActivate ("No se") Sleep(1000) Send("{TAB}") Send(1500) Send("http://www.go-gaia.com/forum/index.php") Sleep(2000) Send("{ENTER}") Sleep(4000) WinActivate ("Gaia") $activ = WinWaitActive("Gaia", "", 9) ;checklives() WEnd EndFunc ;******************** ;Func checklives() ; $alive = WinExists ("Gaia") ; If $alive=0 then ; Run("IEXPORER.EXE", "", @SW_MAXIMIZE) ; checkactiv() ; Endif ;EndFunc ;********************** Func datetime() $min=string(@MIN) $hour=@HOUR $day=string(@MDAY) $mon=string(@MON) $year=string(@YEAR) If $hour=00 then $hour="24" Else $hour=string(@HOUR) Endif $time = $hour & ":" & $min $date= $day & "/" & $mon & "/" & $year $dt=$time & " -- " & $date Return ($dt) EndFunc ;******************** Func Esc1() $pau1="Paused " & datetime() FileWriteLine ( "gaiabot.log", $pau1 ) $pause=MsgBox ( 20, "Gaia bot by Comi BETA", "BOT paused, continue?" ) If $pause=7 then $pau2="Session End " & datetime() FileWriteLine ( "gaiabot.log", $pau2 ) Exit Else $pau3="Session Continued " & datetime() FileWriteLine ( "gaiabot.log", $pau3 ) checkactiv() HotKeySet("{Esc}", "Esc1") Endif EndFunc ;******************************************** ;*************READ THE INI FILE************** ;delays// $indexmin= IniRead("gaiabot.ini", "delays", "indexmin", "error") $indexmax= IniRead("gaiabot.ini", "delays", "indexmax", "error") $forummin= IniRead("gaiabot.ini", "delays", "forummin", "error") $forummax= IniRead("gaiabot.ini", "delays", "forummax", "error") $topicmin= IniRead("gaiabot.ini", "delays", "topicmin", "error") $topicmax= IniRead("gaiabot.ini", "delays", "topicmax", "error") $profmin= IniRead("gaiabot.ini", "delays", "profmin", "error") $profmax= IniRead("gaiabot.ini", "delays", "profmax", "error") $tabmin= IniRead("gaiabot.ini", "delays", "tabmin", "error") $tabmax= IniRead("gaiabot.ini", "delays", "tabmax", "error") ;settings// $IEname= IniRead("gaiabot.ini", "settings", "IEname", "error") $root= IniRead("gaiabot.ini", "settings", "root", "error") $server1= IniRead("gaiabot.ini", "settings", "server1", "error") $server2= IniRead("gaiabot.ini", "settings", "server2", "error") $server3= IniRead("gaiabot.ini", "settings", "server3", "error") $server4= IniRead("gaiabot.ini", "settings", "server4", "error") $server5= IniRead("gaiabot.ini", "settings", "server5", "error") $server6= IniRead("gaiabot.ini", "settings", "server6", "error") $server7= IniRead("gaiabot.ini", "settings", "server7", "error") $server8= IniRead("gaiabot.ini", "settings", "server8", "error") $server9= IniRead("gaiabot.ini", "settings", "server9", "error") $server10= IniRead("gaiabot.ini", "settings", "server10", "error") ;values// $topicini= IniRead("gaiabot.ini", "values", "topicini", "error") $topicend= IniRead("gaiabot.ini", "values", "topicend", "error") $profini= IniRead("gaiabot.ini", "values", "profini", "error") $profend= IniRead("gaiabot.ini", "values", "profend", "error") $tabnummax= IniRead("gaiabot.ini", "values", "tabnummax", "error") $subtabstimes= IniRead("gaiabot.ini", "values", "subtabstimes", "error") ;******check if readed them all correctly IF _ $indexmin= "error" OR _ $indexmax= "error" OR _ $forummin= "error" OR _ $forummax= "error" OR _ $topicmin= "error" OR _ $topicmax= "error" OR _ $profmin= "error" OR _ $profmax= "error" OR _ $tabmin= "error" OR _ $tabmax= "error" OR _ $IEname= "error" OR _ $root= "error" OR _ $server1= "error" OR _ $server2= "error" OR _ $server3= "error" OR _ $server4= "error" OR _ $server5= "error" OR _ $server6= "error" OR _ $server7= "error" OR _ $server8= "error" OR _ $server9= "error" OR _ $server10= "error" OR _ $topicini= "error" OR _ $topicend= "error" OR _ $profini= "error" OR _ $profend= "error" OR _ $tabnummax= "error" OR _ $subtabstimes= "error" _ Then MsgBox(48, "Gaiabot by Comi", "Error reading the ini file") Exit Endif ;********************** ;set hotkey HotKeySet("{Esc}", "Esc1") ;********************** ;************define urls, so this program works only for gaia $index=".gaiaonline.com/forum/index.php" $forum=".gaiaonline.com/forum/viewforum.php?f=" $topic=".gaiaonline.com/forum/viewtopic.php?t=" $profile=".gaiaonline.com/forum/profile.php?mode=viewprofile&u=" ;***********define forum numbers ;gaia online $f1=10 $f2=57 $f3=2 $f4=26 $f5=5 $f6=23 ;gaia gaming $f7=9 $f8=17 $f9=21 $f10=22 $f11=79 ;entretainment $f12=11 $f13=3 $f14=4 $f15=55 $f16=43 $f17=62 ;artist corner $f18=6 $f19=7 $f20=15 ;Studio XD $f21=14 $f22=18 ;MISC Forums $f23=8 $f24=20 ;***********do the dirty work ;log start $start="Session start " & datetime() FileWriteLine ( "gaiabot.log", $start ) WinSetState ( "Gaia", "", @SW_MAXIMIZE ) Sleep (1000) WinActive ("Gaia") While 1;go on forver ;checks if the gaia IE window is ative & exists checkactiv() ;****************pick server***************** $servrand=Int ( Random (1, 10) ) Select Case $servrand=1 $serv=$server1 Case $servrand=2 $serv=$server2 Case $servrand=3 $serv=$server3 Case $servrand=4 $serv=$server4 Case $servrand=5 $serv=$server5 Case $servrand=6 $serv=$server6 Case $servrand=7 $serv=$server7 Case $servrand=8 $serv=$server8 Case $servrand=9 $serv=$server9 Case $servrand=10 $serv=$server10 Case Else MsgBox(48, "Gaiabot by Comi", "No valid servers enabled") $randserv="Error selecting random server " & datetime() FileWriteLine ( "gaiabot.log", $randserv ) Exit EndSelect ;***************PICK URL + number ( what page to view ) ************** ;10% to view index ;15% to view forum ;61% to view topic ;14% to view peofile $urlchance=Int( Random (1, 90) );1% to 100% Select Case $urlchance > 0 AND $urlchance < 6; INDEX $urlcase=1 $url=$index Case $urlchance > 7 AND $urlchance < 22; FORUM $forumrand= Int ( Random (1, 24) );pick a forum ;**********pick the forum number************** Select Case $forumrand=1 $forumnum=$f1 Case $forumrand=2 $forumnum=$f2 Case $forumrand=3 $forumnum=$f3 Case $forumrand=4 $forumnum=$f4 Case $forumrand=5 $forumnum=$f5 Case $forumrand=6 $forumnum=$f6 Case $forumrand=7 $forumnum=$f7 Case $forumrand=8 $forumnum=$f8 Case $forumrand=9 $forumnum=$f9 Case $forumrand=10 $forumnum=$f10 Case $forumrand=11 $forumnum=$f11 Case $forumrand=12 $forumnum=$f12 Case $forumrand=13 $forumnum=$f13 Case $forumrand=14 $forumnum=$f14 Case $forumrand=15 $forumnum=$f15 Case $forumrand=16 $forumnum=$f16 Case $forumrand=17 $forumnum=$f17 Case $forumrand=18 $forumnum=$f18 Case $forumrand=19 $forumnum=$f19 Case $forumrand=20 $forumnum=$f20 Case $forumrand=21 $forumnum=$f21 Case $forumrand=22 $forumnum=$f22 Case $forumrand=23 $forumnum=$f23 Case $forumrand=24 $forumnum=$f24 EndSelect $forumnumb=String ($forumnum);converts to text $urlcase=2 $url=$forum & $forumnumb Case $urlchance > 23 AND $urlchance < 38; ART ;**********pick the forum number************** $topicnum=String ( Int ( Random($topicini, $topicend) ) ) $urlcase=4 $url=$topic & $topicnum EndSelect ;ok after server,url and number are selected ;time to stop blabla and ACT ;*************** ACTIVATING IE ADRESS BAR *************** Send("{TAB}") Sleep(100) ;*************** TIME TO WRITE ******************* $finalurl= $root & $serv & $url Send ($finalurl, 1) Sleep(120) Send("{ENTER}") ;**************** TIME TO SLEEP, OR "READ" WHATEVER YOU WENT TO... *************** Select Case $urlcase=1 $tsleep=Int ( Random($indexmin, $indexmax) ) Case $urlcase=2 $tsleep=Int ( Random($forummin, $forummax) ) Case $urlcase=3 $tsleep=Int ( Random($topicmin, $topicmax) ) Case $urlcase=4 $tsleep=Int ( Random($profmin, $profmax) ) EndSelect Sleep($tsleep);sleep the selected time ;****************time to random tab( go to a link ) random times !!! ************* $subtabtimez=Int( Random (0, $subtabstimes) );times to go to sublinks $subtabstime = 0 While $subtabstime < $subtabstimes $tabtimes=Int( Random (10, $tabnummax) );times to tab to select random link $tabtimz=0 While $tabtimz < $tabtimes Send("{TAB}") $tabtimz = $tabtimz + 1 Sleep(55) WEnd Sleep(200) Send("{ENTER}");goto the random link $subtabstime = $subtabstime + 1 ;calculate the random sleep time $tehsleep=Int ( Random($tabmin, $tabmax) ) Sleep($tehsleep) WEnd ;**************its done so, end the while...****************** WEnd ;END !!
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