mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2013
Posts: 140
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 140
I don't no if this is possible. I keep monthly stats in my channel and need to clear the text file every month end. Any ideas?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Not sure I understand. You have monthly stats you keep in a text file, and you want to know how to delete the file at month end?

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Rather than deleting the file, let's just keep it. Instead, write to a new and different file with the digits of the changing month and year.

Code:
ALIAS -l StatsFile return monthlystats- $+ $asctime(yyyy-mm) $+ .txt

On *:Event: {
  write $StatsFile some statistic
}

You will merely accumulate more and more files at a manageable rate.

monthlystats-2018-11.txt
monthlystats-2018-12.txt
monthlystats-2019-01.txt

etc.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: May 2013
Posts: 140
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 140
Maroon yes that is the idea

Joined: May 2013
Posts: 140
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 140
Racoon that wont help as users can check their own stats with a command that read from the chanstat.txt
Your idea will result in a new text file every month

Joined: Apr 2015
Posts: 19
O
Pikka bird
Offline
Pikka bird
O
Joined: Apr 2015
Posts: 19
if your just looking to clear/remove the stat's file every month ..

Code
on *:LOAD: {
if (!%currentmonth) { set %currentmonth $gettok($fulldate,2,32) }
}

on *:START: {
.timer -o 0 3600 checkdate
}

alias checkdate {
 if (%currentmonth != $gettok($fulldate,2,32)) {
  set %currentmonth $gettok($fulldate,2,32)
  .remove chanstats.txt
 } 
}

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
You'll need to wire it up to whatever event but this should do it for you:

Code
;;/monthlyFile path/to/file
alias monthlyFile {
  if ($asctime($file($1-).ctime, mm-yyyy) != $asctime(mm-yyyy)) {
    .remove $1-
  }
}

Last edited by FroggieDaFrog; 18/12/19 04:53 PM.

I am SReject
My Stuff

Link Copied to Clipboard