-2
bind pub - "!find" pub:cari

proc pub:cari { nick host hand chan text } {
    set judul [lindex $text 0]
    if { $judul == ""} {
        puthelp "notice $nick :ketik !find <penyanyi/artis>"
        return
    } else {
        putquick "notice $nick :being processed $judul"
        catch [list exec find /home/gusman/mp3 -name "*$judul*" -type f -printf "%f\n"] data
        putserv "notice $nick :!putar $data"
        putserv "notice $nick :copy paste di channel !putar $data"
    }
}

putlog "find.tcl"

if sought is in the data it works well to post to the target. if the searched in data is empty, it does not work, please indicate whether this scripts is incomplete or wrong.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
Gusman
  • 37
  • 9

2 Answers2

0

I've got the solution on this line:

if { $judul == ""}
Gusman
  • 37
  • 9
0

Does something like this work?

    proc pub:cari { args } {
        lassign $args nick host hand chan text
        ...

Normally in TCL if you don't pass enough arguments to a function then you'll get an error. If you don't know how many arguments your function will take, you can name the last argument "args", and any extra arguments will be put in this variable as a list.

David B
  • 71
  • 3
  • yes it seems to work, only my problem, how to post the line, the paint I check in the catch log was written as I expected. it's all done, it's just not all linux os or the like it works well, for example: in debian it works fine, but in ubuntu and gento it fails. – Gusman May 11 '18 at 10:02