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.

running files

Old posts that have not been replied to for several years.
Locked
s
sirkrunch
Voice
Posts: 19
Joined: Wed Oct 09, 2002 2:36 am

running files

Post by sirkrunch »

i'm pretty new to tcl and i want to write a script to run a file
what commands and how do I go about it?
s
sirkrunch
Voice
Posts: 19
Joined: Wed Oct 09, 2002 2:36 am

Post by sirkrunch »

this is what I have atm

Code: Select all

bind !cmd - runcmd
proc runcmd { nick uhost handle text dest } {
set blah { /home/usr/prog/prog prog.cfg }
set output [exec $blah]
putserv "PRIVMSG $chan :$output
}
am I on the right track??
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

you have tp specify what type the bind is.

they are all listed in doc/tcl-commands.doc
photon?
s
sirkrunch
Voice
Posts: 19
Joined: Wed Oct 09, 2002 2:36 am

Post by sirkrunch »

Code: Select all

bind pubm !cmd - runcmd
proc runcmd { nick uhost handle text dest } { 
set blah { /home/usr/prog/prog prog.cfg } 
set output [exec $blah] 
putserv "PRIVMSG $chan :$output 
}
is that looking a bit better?
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

with a pubm bind, it matches the whole line of text.

with pub:
"the first word becomes the command and everything else is the argument string"

so it just depends how you'd like to use it i guess.

other than that, i suggest you read tcl-commands.doc again.

(6) PUBM (stackable)
bind pubm <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <text>

because i dont think the putserv "PRIVMSG $chan :$output will work in its current state. you forgot a " and $chan isnt valid in this case.

**EDIT added "will work" so it started making sense hehe :> **
photon?
s
sirkrunch
Voice
Posts: 19
Joined: Wed Oct 09, 2002 2:36 am

Post by sirkrunch »

oops some typos

Code: Select all

 proc runcmd { nick handle chan text } {
is what i ment
so i should use pub like

Code: Select all

bind pub - !cmd runcmd
is that correct?
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

the bind looks correct, but again read tcl-commands.doc.

(4) PUB
bind pub <flags> <command> <proc>
procname <nick> <user@host> <handle> <channel> <text>

proc runcmd { nick handle chan text }

^^

i bet you can see why this wont work :)
photon?
Locked