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 

neophyte scripter getting time to format correctly

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


Joined: 26 Apr 2004
Posts: 9
Location: Dark side of the moon

PostPosted: Thu Jul 05, 2007 2:52 pm    Post subject: neophyte scripter getting time to format correctly Reply with quote

Code:
bind pub - !tf findfile2

proc findfile2 {nick uhost hand chan text} {
         set file1a "/home/BabyEcm/test/test1.txt"
         set file1b "/home/BabyEcm/test/test2.txt"
         set file2a "/home/BabyEcm/test/test3.txt"
         set file2b "/home/BabyEcm/test/test4.txt"
# Open file for read access (note we're not catching errors, you might
# want to use catch {} if the file might not exist.
         puthelp "PRIVMSG $chan :working on a tcl routine to detect files"

         if {[file exists $file1a] == 1} {
               set ynmsg "$file1a does exist"
               set cfdateunix [file mtime $file1a]
               set creationdate [strftime $cfdateunix %r]
            } else {
               set ynmsg "$file1a does NOT exist"
            }

# Here we read in all of the data.

         puthelp "PRIVMSG $chan :$ynmsg, $creationdate"
}


output on channel
Code:
<+BabyEcm> working on a tcl routine to detect files
<+BabyEcm> /home/BabyEcm/test/test1.txt does exist, 1183648942


just writing scripts to learn and how do I get the file modication date to display in english.
_________________
Mac
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Thu Jul 05, 2007 5:40 pm    Post subject: Reply with quote

for starters, you should set creationdate to 0 by default or you will start getting errors with files that don't exist..

You can use strftime to change the output time, have a look at tcl-commands.doc.
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