Dictionary lookup

By BloodHound on Apr 10, 2008

Dictionary script by BloodHound


About


It looks up the definition of a word based on the first result from dictionary.reference.com. You can either use this alias or dialog based.


Syntax


/dict : (Alias syntax mentioned above) Echoes the results of the lookup into the active window


/dictd or channel/menubar popups : (Dialog based mentioned above) Opens up a dialog in which you can type in the word to define and have the results dumped in an editbox. Some find this easier than the alias.

  • Please please please comment! Happy chatting!


    Best wishes,


    BloodHound
alias dict {
  if $1 {
    sockopen dt dictionary.reference.com 80
    set %dt.current $v1 
    set %dt.method echo -tc info2 $iif($active != Status window,$active)
  }
  else {
    echo -atc info *** Error in /dict: Provide correct syntax.
  }
}

alias -l dictd dialog $iif($dialog(dict),-v,-m) dict dict
menu channel,menubar { 
  Dictionary lookup:dictd
}

on *:sockopen:dt:{ 
  sockwrite -nt dt GET /browse/ $+ %dt.current HTTP/1.1
  sockwrite -nt dt Host: dictionary.reference.com 
  sockwrite -nt dt $crlf
}
on *:sockread:dt:{ 
  if $sockerr { 
    %dt.method ! Error in socket ! $sock(dt).wsmsg
  }
  else { 
    var %dtr, %a = unset %dt. $+ $chr(42) $chr(124) sockclose dt
    sockread %dtr
    if *No*found* iswm %dtr { 
      %dt.method *Dictionary Results* No results found.
      scon -at1 %a
    }
    if $regex(%dtr,/1.</td><td valign="top">(.+?)</td>/i) {  
      %dt.method $regsubex($regml(1),/<(.+?)>/g,$null)
      scon -at1 %a
    }
  }
}

dialog dict {
  title "Dictionary look up"
  size -1 -1 230 88
  option pixels
  edit "", 1, 7 9 148 20, autohs
  button "Define", 2, 158 6 65 25
  edit "", 3, 7 31 218 54, read autovs multi vsbar
}

on *:dialog:dict:sclick:2:{ 
  var %a = did -ra $dname 3 
  if !$did(dict,1).text { %a Enter a word to define! }
  else { 
    set %dt.method %a
    sockopen dt dictionary.reference.com 80
    set %dt.current $did(dict,1).text
  }
}

Comments

Sign in to comment.
Al_Bundy33   -  Apr 22, 2008

yeah something like this...

!dict Ghost Ghost : the soul of a dead person, a disembodied spirit imagined, usually as a vague, shadowy or evanescent form, as wandering among or haunting living persons.
 Respond  
Lauranator   -  Apr 21, 2008

hmm yes, i was going to suggest the same thing Al Bundy33 did, to make the defination show in the channel for all to see and not just me. Other than that, nice script.

thx.

 Respond  
Al_Bundy33   -  Apr 20, 2008

can you make a channel version of this script to where someone can type !dict and the word and it gives the results in the channel?

 Respond  
Jonesy44   -  Apr 10, 2008

GRREEAatt chan :P

 Respond  
Eugenio   -  Apr 10, 2008

Very good.

 Respond  
^Neptune   -  Apr 10, 2008

/server -m irc.deltaanime.net -j #jonesy44 YEAH

 Respond  
Jonesy44   -  Apr 10, 2008

go away with you sodding server .. hmmkay ?

 Respond  
L   -  Apr 10, 2008

cool!
btw I think pple will like this. type this in /server 64.32.13.48

 Respond  
BloodHound   -  Apr 10, 2008

Thanks!

 Respond  
PuNkTuReD   -  Apr 10, 2008

small and neat , awesome .

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.