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.

weekdays timer

Old posts that have not been replied to for several years.
Locked
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

weekdays timer

Post by NewzUK »

Hi - I'm trying to send some info to the channel at certain times from Monday to Friday only and another one for Sunday to Thursday only...

I have this proc for starters that will send it for Monday, but is there a way to add the rest of the days of the week to it as well?

bind time - "30 09 *" us:opening
proc us:opening {min hour day month year} {
if {[clock format [clock seconds] -format "%A"] != "Monday"} { return }
putserv "PRIVMSG #Newsroom :stuff to send"
}

any ideas?
Thanks in advance!
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

try using strftime %u wich gives you the weekday, monday is 1 and sunday is 7
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

thanks - any advice on implementing this into my script...?

:-?
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

try with:

Code: Select all

if {![string equal [clock format [clock seconds] -format "%A"] "Monday"]} {
return
}
or search the forum cos I belive this had been discussed before.
Once the game is over, the king and the pawn go back in the same box.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

...and to get it to send the message from monday to friday?

have searched the forum but this dealt with a single day only.
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

NewzBoy wrote:...and to get it to send the message from monday to friday?

have searched the forum but this dealt with a single day only.
Like crazycat said, use the %u formatting and then check if the number is below 6 (i.e. Mon-Fri).
http://www.tcl.tk/man/tcl8.5/TclCmd/clock.htm#M36 wrote: %u
Weekday number (Monday = 1, Sunday = 7)
Locked