ludocus Posted September 26, 2010 Share Posted September 26, 2010 (edited) Hi!I made this little example because it's kinda funny and could help people working with IE.So basicly what this does is find a word related to your word and do that with the last related word for about 10 times so that you get something strange and off-topic.Code:expandcollapse popup#include <IE.au3> $sNames = '' $x = _GetRelated('autoit', 10) $sText = '1) '&$x[1]&' = '&$x[2]&@CRLF&'2) '&$x[2]&' = '&$x[3]&@CRLF&'3) '&$x[3]&' = '&$x[4]&@CRLF&'4) '&$x[4]&' = '&$x[5]&@CRLF&'5) '&$x[5]&' = '&$x[6]&@CRLF&'6) '&$x[6]&' = '&$x[7]&@CRLF&'7) '&$x[7]&' = '&$x[8]&@CRLF&'8) '&$x[8]&' = '&$x[9]&@CRLF&'9) '&$x[9]&' = '&$x[10] ClipPut($x[1]&' = '&$x[10]&@CRLF&@CRLF&'Because:'&@CRLF&$sText) Msgbox(0, $x[1]&' = '&$x[10], $sText&@CRLF&@CRLF&'It has been put into your clipboard') Func _GetRelated($sWord, $nTimes=3) global $sLink[1] = ['?q='&$sWord] $sNames = '' $oIE = _IECreate('about:blank', 0, 0) global $sReturn[$nTimes+1] $sReturn[1] = $sWord For $i = 2 to $nTimes $sLink = _RelateHelper($sLink[0], $oIE) $sReturn[$i] = $sLink[1] ;If you're getting an error use: Sleep(2000) Next _IEQuit($oIE) Return $sReturn EndFunc Func _RelateHelper($sWord, $oIE) _IENavigate($oIE, 'http://search.swagbucks.com/'&$sWord) $sHTML = _IEBodyReadHTML($oIE) $zX = StringSplit($sHTML, 'Related searches', 1) $zX1 = StringSplit($zX[2], '</UL>', 1) $zX2 = StringSplit($zX1[1], '<A href="', 1) global $xLink[$zX2[0]+1][3] $x = 0 For $i = 2 to $zX2[0] $zX3 = StringSplit($zX2[$i], '">', 1) $xLink[$i-1][1] = $zX3[1] $zX4 = StringSplit($zX3[1], '=') $xLink[$i-1][2] = $zX4[4] $x += 1 Next if $sNames <> '' Then Do $num = Random(1, $x, 1) $sName = _Clean($xLink[$num][2]) Until _NotInString($sNames, $sName, '|') $sNames &='|'&$sName Else $num = Random(1, $x, 1) $sName = _Clean($xLink[$num][2]) $sNames = $sName EndIf global $sRet[2] = [_Tidy($xLink[$num][1]), $sName] Return $sRet EndFunc Func _Clean($text) $text = StringReplace($text, '<b>', '') $text = StringReplace($text, '</b>', '') $text = StringReplace($text, '<B>', '') $text = StringReplace($text, '</B>', '') $text = StringReplace($text, '<u>', '') $text = StringReplace($text, '</u>', '') $text = StringReplace($text, '<U>', '') $text = StringReplace($text, '</U>', '') $text = StringReplace($text, '<i>', '') $text = StringReplace($text, '</i>', '') $text = StringReplace($text, '<I>', '') $text = StringReplace($text, '</I>', '') $text = StringReplace($text, '+', ' ') return $text EndFunc Func _Tidy($text) $text = StringReplace($text, 'amp;', '') return $text EndFunc Func _NotInString($sString, $sSubString, $sIndicator) $xzp = StringSplit($sString, $sIndicator, 1) For $i = 1 to $xzp[0] if $xzp[$i] = $sSubString then Return 0 Next Return 1 EndFuncOutput script first time:autoit = Excel 2007 Free Online Tutorial EngineerBecause:1) autoit = Makro Cash Carry2) Makro Cash Carry = Excel Macro Example3) Excel Macro Example = Excel Macros4) Excel Macros = Excel 2007 Macros5) Excel 2007 Macros = Excel 2007 Unprotect Sheet Macro6) Excel 2007 Unprotect Sheet Macro = Excel 2007 Autofil Macro7) Excel 2007 Autofil Macro = Excel 20078) Excel 2007 = Free Excel 2007 Tutorials9) Free Excel 2007 Tutorials = Excel 2007 Free Online Tutorial EngineerOutput script second time:autoit = Stores LocationsBecause:1) autoit = Makro Cash Carry2) Makro Cash Carry = Cash And Carry3) Cash And Carry = Cash N Carry4) Cash N Carry = Grocery Outlet5) Grocery Outlet = Big Lots6) Big Lots = Big Lots Discount Stores7) Big Lots Discount Stores = Big Lots Stores8) Big Lots Stores = Big Lots Store Locations9) Big Lots Store Locations = Stores LocationsOutput script third time:autoit = Best Buffet In Las VegasBecause:1) autoit = Guys Automated2) Guys Automated = Rockwell Automation3) Rockwell Automation = Jim Pinto Rockwell Automation Weblog4) Jim Pinto Rockwell Automation Weblog = Rok5) Rok = La Rok6) La Rok = La7) La = Las Vegas8) Las Vegas = Las Vegas Coupons Buffet9) Las Vegas Coupons Buffet = Best Buffet In Las VegasPlease post what you get!Enjoy! Edited September 27, 2010 by ludocus Link to comment Share on other sites More sharing options...
JohnOne Posted September 26, 2010 Share Posted September 26, 2010 Errors out for me around line 25, in _RelateHelper($sWord, $oIE) function on this line... ... $zX1 = StringSplit($zX[2], '</UL>', 1) Subscript array element or dimension error. Sounds good for a giggle. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
SeF Posted September 27, 2010 Share Posted September 27, 2010 Errors out for me around line 25, in _RelateHelper($sWord, $oIE) function on this line... ... $zX1 = StringSplit($zX[2], '</UL>', 1) Subscript array element or dimension error. Sounds good for a giggle. I got the same error. But I guess it's because that this site is blocked in my job. Link to comment Share on other sites More sharing options...
JohnOne Posted September 27, 2010 Share Posted September 27, 2010 I doubt it, as no sites are blocked here. I put a consolewrite in and it errors out at 7 (I suspect it ought to go to 10 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ludocus Posted September 27, 2010 Author Share Posted September 27, 2010 Ok I think I found the bug. When you search to fast more than once at swagbucks.com it redirects you to some bullsh*t site. So just use the new script. (it has sleep(2000) in the loop) 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