[01:25] Tcl error [down:pub]: invalid command name "http::geturl"
Code: Select all
bind pub m !down down:pub
proc down:pub {nick uhost hand chan arg} {
puts [http::data [http::geturl [lindex $arg 0]] -binary boolean ]
}
[01:25] Tcl error [down:pub]: invalid command name "http::geturl"
Code: Select all
bind pub m !down down:pub
proc down:pub {nick uhost hand chan arg} {
puts [http::data [http::geturl [lindex $arg 0]] -binary boolean ]
}
so what am i doing wrong ?[01:30] Tcl error [update:pub]: wrong # args: should be "::http::geturl url args"
Code: Select all
bind pub m !update update:pub
proc down:pub {nick uhost hand chan arg} {
set url [lindex $arg 0]
puts [http::data [http::geturl $url -binary boolean]]
}
That's not it. Read the error messagecaesar wrote:Doh! use ::http::geturl not http::geturl
Code: Select all
set url [lindex $arg 0]
Code: Select all
puts [http::data [http::geturl $url -binary boolean]]
Code: Select all
bind pub m !update update:pub
proc down:pub {nick uhost hand chan arg} {
set url [lindex [split $arg] 0]
set fid [open somefile w+]
set body [http::data [set token [http::geturl $url -binary 1 -timeout 9999]]]
puts $fid $body
catch {close $fid}
http::cleanup $token
}
There's no need to catch close. Do you have any particular reason for doing it? (I've seen you do it in other posts too iirc)Papillon wrote:Code: Select all
catch {close $fid}
Code: Select all
source lib/tcl8.4/http2.4/http.tcl
bind pub m !update update:pub
proc update:pub {nick uhost hand chan arg} {
set out [lindex $arg 0]
set url [lindex [split $arg] 1]
set fid [open $out w+]
set body [http::data [set token [http::geturl $url -binary 1 -timeout 9999]]]
puts $fid $body
close $fid
http::cleanup $token
putquick "NOTICE $nick :Download complete."
}