This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Kamus.net english indonesian dictionary help

Help for those learning Tcl or writing their own scripts.
Post Reply
a
ardantus
Voice
Posts: 8
Joined: Wed Apr 09, 2008 7:18 pm

Kamus.net english indonesian dictionary help

Post by ardantus »

Code: Select all

bind pub - !dic dictionary1
bind pub - !dic2 dictionary2

proc dictionary1 { nick uhost handle chan arg } {
        set arg [string tolower $arg]
        if {[string length $arg] == 0} {
                putserv "NOTICE $nick :The right command is !trans <word>"
        } {
                regsub -all {( )} $arg "%20" argu

                set urlduprog "http://www.kamus.net/result.php?w=en-usa&q=$argu&submit=Search&e=0"

                set trucdebut  [http::geturl $urlduprog -timeout 20000]
                if {[::http::status $trucdebut] == "timeout"} {
                        putserv "PRIVMSG $chan :  (TimeOut)"
                }

                set datadehtml [::http::data $trucdebut]
                set finishhttp [http::Finish $trucdebut]

                    regsub -all {(\t)} $datadehtml "" datanya
                    regsub -all {(\n)} $datanya "" datanya

                        set nopage [string first "<td class=\"item\" bgcolor=\"#CDCCB1\">" $datanya 0]
                        set arti [string range $datanya $nopage [expr [string first "</td>" $datanya $nopage] - 1]]

                        regsub -all {(<.+?>)} $arti "" arti

                    if {![string first "Search Results" $arti 0]} {
                putserv "PRIVMSG $chan :$argu tidak terdapat dalam database"
                        } else {
                    putserv "PRIVMSG $chan :Inggris ke Indonesia => $argu = $arti" }

        }
}

proc dictionary2 { nick uhost handle chan arg } {
        set arg [string tolower $arg]
        if {[string length $arg] == 0} {
                putserv "NOTICE $nick :Perintah yang benar adalah !arti <kata>"
        } {
                regsub -all {( )} $arg "%20" argu

                set urlduprog "http://www.kamus.net/result.php?w=id-indonesia&q=$argu&&submit=Search&e=0"

                set trucdebut  [http::geturl $urlduprog -timeout 20000]
                if {[::http::status $trucdebut] == "timeout"} {
                        putserv "PRIVMSG $chan :  (TimeOut)"
                }

                set datadehtml [::http::data $trucdebut]
                set finishhttp [http::Finish $trucdebut]

                    regsub -all {(\t)} $datadehtml "" datanya
                    regsub -all {(\n)} $datanya "" datanya

                        set nopage [string first "<td class=\"itembold\" bgcolor=\"#CDCCB1\">" $datanya 0]
                        set arti [string range $datanya $nopage [expr [string first "</td>" $datanya $nopage] - 1]]

                        regsub -all {(<.+?>)} $arti "" arti

                    if {![string first "Search Results" $arti 0]} {
                putserv "PRIVMSG $chan :$argu tidak terdapat dalam Kamus"
                        } else {
                    putserv "PRIVMSG $chan :Indonesia Ke Inggris => $argu = $arti" }

        }
}
---------------------------------------------------------------------------------
can you solved my problem, if i type in the #chanel not shown then result

<ardan> !dic store
<ardantus> Inggris ke Indonesia => store =
<ardan> !dic2 bakar
<ardantus> Indonesia Ke Inggris => bakar =
--------------------------------------------------------------------------[/code]
Post Reply