Google Dialog Search
The dialog is pretty self explanatory. Just type something in the box and click search.
The link boxes are single click with a yes/no $input box.
Links that say things like "video results for", can be clicked to generate more links.
You will find the dialogs under Google Dialog on the channel,status or menubar menu.
Update This post has been trunicated to only include the dialog portion because I decided to make a new search engine with Googles API.
The original code can be found here --> http://pastebin.com/q3ASC3MA
I will post the new Google bot search A.S.A.P.
;Google Script by Ford_Lawnmower irc.mindforge.org #USA
dialog Google_Search {
title "Google Search"
size -1 -1 184 248
option dbu
edit "", 1, 8 14 130 10, autohs rich
button "Search", 2, 139 14 37 12
text "Enter your Search Below", 3, 56 6 73 8
text "Results:", 4, 82 24 25 8, center
text "", 5, 1 32 183 24, left
text "", 6, 1 72 183 24, left
text "", 7, 1 112 183 24, left
text "", 8, 1 152 183 24, left
text "", 9, 1 192 183 24, left
link "", 10, 1 56 182 16, left
link "", 11, 1 96 182 16
link "", 12, 1 136 182 16
link "", 13, 1 176 182 16
link "", 14, 1 216 182 16
button "Close", 15, 144 235 37 12, Cancel
text "", 16, 0 232 137 16
box "", 17, 0 28 184 44
box "", 18, 0 68 184 44
box "", 19, 0 108 184 44
box "", 20, 0 148 184 44
box "", 21, 0 188 184 44
icon 22, 0 2 47 11
}
On *:Dialog:Google_Search:init:*: {
if (!$isfile(logo_sm.gif)) { getlogo | .timer 1 2 did -g Google_Search 22 logo_sm.gif }
else { did -g Google_Search 22 logo_sm.gif }
google hawkee snippets FordLawnmower
}
On *:Dialog:Google_Search:Close:*: {
unset GoogleDialog.*
if ($sock(GoogleDialog)) { sockclose GoogleDialog }
}
On *:Dialog:Google_Search:Sclick:2: {
if ($did(Google_Search,1).text) {
var %count = 5
while (%count <= 14) {
did -r Google_Search %count
inc %count
}
did -r Google_Search 16
Google $did(Google_Search,1).text
}
else { return }
}
On *:Dialog:Google_Search:Sclick:10-14: {
if ($did(Google_Search,$did).text) {
if (http:// isin $left($did(Google_Search,$did).text,7)) {
if ($input(Are you sure you want to load $did(Google_Search,$did).text $+ ?,y,,,)) { run $did(Google_Search,$did).text }
else { return }
}
else {
did -r Google_Search 16
Google $did(Google_Search,$did).text
}
}
else { return }
}
alias -l Google.timeout {
echo -gat >Connection Timed Out< Google Script
Google.clear
}
alias -l Google.clear {
sockclose Google*
unset %Google*
.timer-Google* off
halt
}
alias -l Google {
sockclose DialogGoogle
sockopen DialogGoogle www.google.com 80
svar DialogGoogle search $replace($1-,$chr(32),+)
}
on *:sockopen:DialogGoogle: {
sockwrite -nt $sockname GET $+(/search?client=opera&rls=en&q=,$svar($sockname,search),&sourceid=opera&ie=utf-8&oe=utf-8) HTTP/1.1
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -n $sockname $crlf
}
on *:sockread:DialogGoogle: {
if ($sockerr > 0) { echo -a >Sock Error< Google | Google.clear }
else {
sockread &Google
var %count 1
while ($svar($sockname,count) != 5 && $bintween(&Google,$+(this,$chr(44),$chr(32),'/url?q=),</a>,%count)) {
tokenize 1 %line $strip($replace($regsubex($v1,/&(.*?)>/i,$chr(1)),<b>,$chr(2),</b>,$chr(2)))
svar $sockname count $calc($svar($sockname,count) + 1)
did -a Google_Search $calc(4 + $svar($sockname,count)) $2
did -a Google_Search $calc(9 + $svar($sockname,count)) $1
inc %count
}
}
}
menu channel,status,menubar {
Google Dialog:dialog $iif($dialog(Google_Search),-v,-m) Google_Search Google_Search
}
alias -l bintween {
var %count = 1, %mark = 0, %mark2 = 0
while (%count <= $4) {
if ($bfind($1, %mark2, $2).text) {
%mark = $calc($bfind($1, %mark2, $2).text + $len($2))
if ($bfind($1, %mark, $3).text) {
%mark2 = $bfind($1, %mark, $3).text
}
else { return 0 }
}
else { return 0 }
inc %count
}
if ($calc(%mark2 - %mark) > 960) && ($version < 6.32) { return 0 }
else { return $bvar($1, $iif(%mark > 0,%mark,1), $calc(%mark2 - %mark)).text }
}
alias -l httpstrip {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}
Alias -l GetLogo {
if ($isfile(logo_sm.gif)) { return }
sockclose GetLogo
sockopen GetLogo $svar($sockname,logosite) 80
svar GetLogo logourl /images/logo_sm.gif
svar GetLogo logopicname logo_sm.gif
}
On *:sockopen:GetLogo:{
sockwrite -nt $sockname GET $svar($sockname,logourl) HTTP/1.0
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -n $sockname $crlf
}
On *:sockread:GetLogo:{
if (!$sock($sockname).mark) {
var %GetLogo.var | sockread %GetLogo.var
if (%GetLogo.var == $null) { sockmark $sockname 1 }
}
else {
sockread &logo
bwrite logo_sm.gif -1 -1 &logo
}
}
alias -l Svar {
var %sockname $1, %item $2
if ($isid) {
if ($regex(Svar,$sock(%sockname).mark,/ $+ %item $+ \x01([^\x01]*)/i)) return $regml(Svar,1)
}
else {
tokenize 124 $2-
var %count 1
while (%count <= $0) {
var %record $($+($,%count),2), %item $gettok(%record,1,32), %value $gettok(%record,2-,32)
if (!$regex($sock(%sockname).mark,/ $+ %item $+ \x01/i)) sockmark %sockname $+($sock(%sockname).mark,$chr(1),%item,$chr(1),%value)
else sockmark %sockname $regsubex($sock(%sockname).mark,/( $+ %item $+ \x01[^\x01]*)/i,$+(%item,$chr(1),%value))
inc %count
}
}
}
Sorry Heartbroken :( This script is broken.
I'll fix it a little later this weekend.
I have also removed the bot search from this script and replaced it with this one -->> http://www.hawkee.com/snippet/7465/ <<-- A much better search engine.
last couple of weeks i have a problem with this :/
Dunno why cus it works realy great before and i appreciated for this to you Ford_Lawnmower realy super scripting.:)
but now it didn't work ..when i try to make a !google search bot shows nuthin when i re-type it noticed me -> - Google in use!!
so i check into bot .on bot's status window wrotes ->
/sockwrite: 'Google#mychanname' not connected (line 95, script31.mrc)
so i unload -re-load many times and i try to check to wtf is .
i found -> nuthin :P
so pls help meh to find whats happen .huh ?
thnx..
Thanks PATX :)
@eyiezinc Can you elaborate on how you got that error, what your search was, etc. Also your version of mIRC. That error will only be produced with a call to $bvar for more than 960 characters in versions of mirc older than 6.32.
I've tested this script repeatedly with mIRC 6.21, with no problems other than the occasional inconsistency, caused by Youtube link blocks ;/
Any information you can give me eyiezinc, will be appreciated :)
It is my intention to make this script work equally as well with older versions of mirc.
I found the bug, reproduced it and added a fix. I got the same error from the default search with mIRC 6.30. Added this line.
if ($calc(%mark2 - %mark) > 960) && ($version < 6.32) { return 0 }
A line over 960 would never match a search result so I just nulled it with Zero :)
When I looked up Hawkee using the dialog, it didn't return the first item.
What should be returning as the first item is: > Hawkee Technology Social Network
mIRC script resource site with scripting tips, articles and downloads.
http://www.hawkee.com/