egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using bind to remove a file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
topdawg_b
Voice


Joined: 07 Dec 2008
Posts: 32

PostPosted: Tue Dec 09, 2008 11:00 pm    Post subject: using bind to remove a file Reply with quote

I have instruction files i allow people to make. People make mistakes. I need a command that deletes a file. Ive looked. I havent found one yet. I found 1 to remove a directory but not a file
i want to use pubm -|- !remfile del:file then put the command in my proc
thanks
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Wed Dec 10, 2008 6:58 am    Post subject: Reply with quote

file delete command:
Code:
file delete $file


http://www.tcl.tk/man/tcl8.4/TclCmd/file.htm#M12

:>
Back to top
View user's profile Send private message Visit poster's website
topdawg_b
Voice


Joined: 07 Dec 2008
Posts: 32

PostPosted: Wed Dec 10, 2008 9:37 am    Post subject: Reply with quote

that's what i was looking for ty very much.
Back to top
View user's profile Send private message
topdawg_b
Voice


Joined: 07 Dec 2008
Posts: 32

PostPosted: Wed Dec 10, 2008 12:04 pm    Post subject: Reply with quote

im confused this is my proc

#delete the file process

proc del:file {nick user@host handle text} {
set delfile [lindex $text 1].ins
putserv "PRIVMSG $nick :[lindex $text 1] has been removed"
[file delete $delfile]
}

it works like it is but if I place the putserv command beneath the
[file delete $delfile]
the putserv command does not execute. above it, it works fine.
what is it in [file delete $delfile] that stops my process
if I had to execute something after this command how would I?
thanks so much
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Dec 10, 2008 12:30 pm    Post subject: Reply with quote

1st:
Don't use lindex like that... $text is a string, not a list (consider using split to convert it into a list).

2nd:
Don't enclose the file command with [] if you do not intend to make use of the return code. Currently, you are trying to execute the return code from the file delete operation as a new command.
The file delete command will always return an empty string, causing your script to try and execute "", which is not a valid command. This will generate an error, and script execution is terminated.

Suggested further reading:
Tcl manual page - Command substitutions
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
topdawg_b
Voice


Joined: 07 Dec 2008
Posts: 32

PostPosted: Wed Dec 10, 2008 10:59 pm    Post subject: Reply with quote

ty for the info I am new to this. it is a lot to consume. info seems to be spread out. I will read. thanks for the help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber