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.
Help for those learning Tcl or writing their own scripts.
ultralord
Master
Posts: 255 Joined: Mon Nov 06, 2006 6:52 pm
Post
by ultralord » Mon Jul 30, 2007 1:16 pm
hello .. how i can put timer command on tcl script.. i want every 5 minites to run one variable.. etc..
how i can do this?
thanks you
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Mon Jul 30, 2007 1:20 pm
Either use a time-binding, or make a call to the timer command from within your proc.
NML_375
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Mon Jul 30, 2007 1:22 pm
Either use bind time:
Code: Select all
bind time {?0 * * * *} myproc
bind time {?5 * * * *} myproc
proc myproc {min hour day month year} {
# do my stuff here
}
Or just keep setting a timer:
Code: Select all
timer 5 [list myproc ?proc arguments?]
proc myproc {?proc arguments?} {
# do my stuff here
timer 5 [list myproc ?proc arguments?]
}
Hope this helps!
r0t3n @ #r0t3n @ Quakenet
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Jul 30, 2007 4:01 pm
ultralord
Master
Posts: 255 Joined: Mon Nov 06, 2006 6:52 pm
Post
by ultralord » Mon Aug 06, 2007 7:45 am
because i am confused..
i want after 5 minites one proc run..
#procname : Delete
proc Delete
............
.....
utimer 5 Delete.. (and after 5 minites "Delete" is running)
something like that.. ?
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Mon Aug 06, 2007 11:43 am
timer and
utimer delays the execution of a command by the time you specify (
timer delays n minutes, while
utimer delays n seconds).
Neither timer or utimer will repeat the command, bur simply execute it once after the specified delay, and they do not block execution of code while "counting down".
In your case,
would cause your script to execute the command Delete after 5 seconds.
NML_375
ultralord
Master
Posts: 255 Joined: Mon Nov 06, 2006 6:52 pm
Post
by ultralord » Tue Aug 07, 2007 1:47 pm
yes i want to run the proc DELETE always afte 5 minites like..
timer 5 DELETE
something like that?
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Aug 07, 2007 2:38 pm
nml375 already made it clear that a timer will call the procedure only ONCE after n minutes. It is up to you to call the timer again inside your procedure each time it's called.
awyeah
Revered One
Posts: 1580 Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:
Post
by awyeah » Tue Aug 07, 2007 8:15 pm
ultralord wrote: yes i want to run the proc DELETE always afte 5 minites like..
timer 5 DELETE
something like that?
Then you need something like this:
Code: Select all
timer 5 [list delete $args]
proc delete {args} {
#do your stuff here
###
#call timer to repeat execution
timer 5 [list delete $args]
}
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================