Acronym Finder

By mountaindew on Jun 17, 2008

So this is just a little acronym finder. You right click and hit "Acronym Finder" to open up the dialog, and you type in the acronym and click search. For example, you type in "BBL" and hit the search button.

Here's a screen:

Image

Enjoy Image

;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
;         Acronym Finder          ;
;       Made by MountainDew       ;
; IRC.UnderNet.org ~ #Hawkee.com  ;
;     IRC.SwiftIRC.net ~ #mSL     ;
;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

menu * {
  Acronym Finder: acronyms
}

alias noresults noop $input(Sorry $+ $chr(44) no results found.,io,No results)
alias acronyms dialog $iif($dialog(acronyms),-v,-m) acronyms acronyms

on *:text:!acronym *:#:{
  if (!$2) .notice $nick Syntax: /acronym [acronym]
  elseif ($sock(acro)) .notice $nick Sorry, there's already a request in progress.
  sockopen acro silmaril.ie 80
  sockmark acro $2
  set %acro.msg .notice $nick
}

dialog acronyms {
  title "Acronym Finder"
  size -1 -1 87 100
  option dbu
  button "OK", 1, 31 89 23 9, ok cancel
  text "Acronym Finder", 2, 23 3 40 8, center
  edit "", 3, 6 20 45 10
  button "Search", 4, 54 20 27 10, disable
  list 5, 6 42 75 42, size hsbar vsbar
  box "Definitions", 6, 3 34 81 53
  box "Acronym", 7, 3 12 81 21
}
on *:dialog:acronyms:*:*:{
  if ($devent == edit && $did == 3) {
    did $iif($did($dname,3) != $chr(32) && $v1,-e,-b) $dname 4
    did -r $dname 5
  }
  if ($devent == sclick && $did == 4) {
    if ($sock(acro)) sockclose acro
    did -b $dname 4
    did -r $dname 5
    sockopen acro silmaril.ie 80
    sockmark acro $gettok($did($dname,3),1,32)
    set %acro.msg did -a acronyms 5
  }
}

on *:sockopen:acro:{
  sockwrite -nt $sockname GET /cgi-bin/uncgi/acronyms/?terms= $+ $sock($sockname).mark HTTP/1.1
  sockwrite -nt $sockname Host: silmaril.ie
  sockwrite -nt $sockname $crlf
}
on *:sockread:acro:{
  var %x
  sockread %x
  if ($regex(%x,/<dd><b><a title=".+">(.+)<\/a><\/b>/i)) { 
    %acro.msg $regml(1) 
  }
  if (Found: isin %x) {
    if ($dialog(acronyms)) {
      did -e acronyms 4
      did -z acronyms 5
    }
    if (!$mid(%x,11,1)) .timernoresults 1 0 noresults
    sockclose $sockname
    unset %acro.msg
  }
}

Comments

Sign in to comment.
Scakk   -  Mar 10, 2011

The website change the website link to something different so the script is not using the up to date one. If you wish to still use the above code you can use the below version which uses the correct website link.

;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
;         Acronym Finder          ;
;       Made by MountainDew       ;
; IRC.UnderNet.org ~ #Hawkee.com  ;
;     IRC.SwiftIRC.net ~ #mSL     ;
;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

menu * {
  Acronym Finder: acronyms
}

alias noresults noop $input(Sorry $+ $chr(44) no results found.,io,No results)
alias acronyms dialog $iif($dialog(acronyms),-v,-m) acronyms acronyms

on *:text:!acronym *:#:{
  if (!$2) .notice $nick Syntax: !acronym [acronym]
  elseif ($sock(acro)) .notice $nick Sorry, there's already a request in progress.
  sockopen acro acronyms.silmaril.ie 80
  sockmark acro $2
  set %acro.msg .notice $nick
}

dialog acronyms {
  title "Acronym Finder"
  size -1 -1 87 100
  option dbu
  button "OK", 1, 31 89 23 9, ok cancel
  text "Acronym Finder", 2, 23 3 40 8, center
  edit "", 3, 6 20 45 10
  button "Search", 4, 54 20 27 10, disable
  list 5, 6 42 75 42, size hsbar vsbar
  box "Definitions", 6, 3 34 81 53
  box "Acronym", 7, 3 12 81 21
}
on *:dialog:acronyms:*:*:{
  if ($devent == edit && $did == 3) {
    did $iif($did($dname,3) != $chr(32) && $v1,-e,-b) $dname 4
    did -r $dname 5
  }
  if ($devent == sclick && $did == 4) {
    if ($sock(acro)) sockclose acro
    did -b $dname 4
    did -r $dname 5
    sockopen acro acronyms.silmaril.ie 80
    sockmark acro $gettok($did($dname,3),1,32)
    set %acro.msg did -a acronyms 5
  }
}

on *:sockopen:acro:{
  sockwrite -nt $sockname GET /cgi-bin/uncgi/acronyms? $+ $sock($sockname).mark HTTP/1.1
  sockwrite -nt $sockname Host: acronyms.silmaril.ie
  sockwrite -nt $sockname $crlf
}
on *:sockread:acro:{
  var %x
  sockread %x
  if ($regex(%x,/<dd><b><a title=".+">(.+)<\/a><\/b>/i)) { 
    %acro.msg $regml(1) 
  }
  if (Found: isin %x) {
    if ($dialog(acronyms)) {
      did -e acronyms 4
      did -z acronyms 5
    }
    if (!$mid(%x,11,1)) .timernoresults 1 0 noresults
    sockclose $sockname
    unset %acro.msg
  }
}
More
 Respond  
bolt5099   -  Mar 10, 2011

Mountaindew, search button not working. Novice scripter

More
 Respond  
ShesPrettyAsACarCrash   -  Dec 19, 2008

Thank you much Mountain Dew! ^-^

More
 Respond  
uneek   -  Dec 17, 2008

Thanks mountaindew, I really appreciate it.

More
 Respond  
mountaindew   -  Dec 17, 2008

Okay, added a trigger - !acronym [acronym]

More
 Respond  
mountaindew   -  Dec 17, 2008

Alright, I'll take a look at it when I get home.

More
 Respond  
ShesPrettyAsACarCrash   -  Dec 17, 2008

Is there any triggers we can use, because it seems there is a big problem with Errors.

More
 Respond  
uneek   -  Dec 17, 2008

Is there any way to make this into a !trigger so other users can use it?

More
 Respond  
uneek   -  Dec 17, 2008

Perfect! Ty Scakk

More
 Respond  
Scakk   -  Dec 17, 2008

Change line 42 to the below.

if ($regex(%x,/<dd><b><a title=".+">(.+)<\/a><\/b>/i) && $dialog(acronyms)) { did -a acronyms 5 $regml(1) }
More
 Respond  
pwnisher3   -  Dec 17, 2008

me too -_-

More
 Respond  
uneek   -  Dec 09, 2008

Looks nice. I get this error though.

  • /if: 'did' unknown operator (line 42, script1)
More
 Respond  
mountaindew   -  Jun 23, 2008

Added if ($dialog(acronyms)) {

More
 Respond  
vaseline28   -  Jun 22, 2008

Yeah, it\'s not a particularily necessary thing to do, it\'s just nice to totally clean out any possibility of an error message, however small, unlikely and irrelevant.

More
 Respond  
RagBot   -  Jun 22, 2008

If you close the dialog when it is processing an acronym, then you get an error message because it is trying to add a line to a closed dialog. You could always be careful not to do that, and you\'d just hae to turn the dialog back on, but that code could help stop future problems.(good work vaseline28 on the code) Other than that it\'s a great script that\'s could be fun and handy 9/10

More
 Respond  
vaseline28   -  Jun 21, 2008

If you close the dialog when it is processing an acronym, then you get an error message because it is trying to add a line to a closed dialog. You could go:

did -a acronyms 5 $iif($dialog(acronyms),$regml(1),)

More
 Respond  
Seven_Dayss   -  Jun 18, 2008

whoaa,,

looking good & works great!

lol

More
 Respond  
EL   -  Jun 18, 2008

ROFL butcherer:P,aint tested it yet MD but looks good.`-.-ยด

More
 Respond  
Noutrious   -  Jun 18, 2008

Thanks for the socket part, re-edited it and made it for my bot :)

More
 Respond  
vaseline28   -  Jun 18, 2008

Works great, and a nice small, easy to use interface! Edit: 10, I found no bugs and with english not as my first language, anything to help the acronyms is good (very useful)

More
 Respond  
Cheiron   -  Jun 17, 2008

awesome basically. gets the thumbs up here and a 10 rating. nice one mountaindew and thanks for posting it

More
 Respond  
Jamiie   -  Jun 17, 2008

Neat work mountaindew, works great. :)

8/10

More
 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.