Sign in to follow this  
Followers 0
ludocus

Find the true meaning of a word!

5 posts in this topic

#1 ·  Posted (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:

#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
EndFunc

Output script first time:

autoit = Excel 2007 Free Online Tutorial Engineer

Because:

1) autoit = Makro Cash Carry

2) Makro Cash Carry = Excel Macro Example

3) Excel Macro Example = Excel Macros

4) Excel Macros = Excel 2007 Macros

5) Excel 2007 Macros = Excel 2007 Unprotect Sheet Macro

6) Excel 2007 Unprotect Sheet Macro = Excel 2007 Autofil Macro

7) Excel 2007 Autofil Macro = Excel 2007

8) Excel 2007 = Free Excel 2007 Tutorials

9) Free Excel 2007 Tutorials = Excel 2007 Free Online Tutorial Engineer

Output script second time:

autoit = Stores Locations

Because:

1) autoit = Makro Cash Carry

2) Makro Cash Carry = Cash And Carry

3) Cash And Carry = Cash N Carry

4) Cash N Carry = Grocery Outlet

5) Grocery Outlet = Big Lots

6) Big Lots = Big Lots Discount Stores

7) Big Lots Discount Stores = Big Lots Stores

8) Big Lots Stores = Big Lots Store Locations

9) Big Lots Store Locations = Stores Locations

Output script third time:

autoit = Best Buffet In Las Vegas

Because:

1) autoit = Guys Automated

2) Guys Automated = Rockwell Automation

3) Rockwell Automation = Jim Pinto Rockwell Automation Weblog

4) Jim Pinto Rockwell Automation Weblog = Rok

5) Rok = La Rok

6) La Rok = La

7) La = Las Vegas

8) Las Vegas = Las Vegas Coupons Buffet

9) Las Vegas Coupons Buffet = Best Buffet In Las Vegas

Please post what you get!

Enjoy!

Edited by ludocus

Share this post


Link to post
Share on other sites



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.


Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0