mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
Hi again,
I am trying to create a log system.

First, here is my script:
Code:
on *:TEXT:*:# {
  if ($me == no-nick) { write "C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\ $+ $network $+ \ $+ $chan $+ \ $+ $asctime($calc($gmt - $duration(0hrs)),dd.mm.yy) $+ \ $+ index.htm" <br><font size="2" face="Verdana"> $asctime($calc($gmt - $duration(0hrs)),h:nntt) GMT - $asctime($calc($gmt - $duration(5hrs)),h.nntt) PST --<b> $nick $+ : </b> $1- }
}

However...
This doesn't seam to work...
Instead I get:
Quote:
-
* /write: unable to open file 'C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\Ustream\#iwearyourshirt-daily-shirt-s\04.04.09\index.htm' (line 2, onlinelogsTBINT)
-


When I create all the folders needed, it writes correctly, but, the objective of the script is to separate all the logs out into days, so they are more easily readable, and can be uploaded to the internet, to be read if people want it to be. It would be very difficult to have all the folders created, and so I need a way I can automate it.

Thank you very much for any help smile

Last edited by seanturner70; 04/04/09 07:44 PM.
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
$isdir

$exists

/mkdir

-genius_at_work

Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
Thank you.

I have tried using this, but I am obviously not using it correctly. I have tried many different variations of it, and the closest I have got is:
Quote:
-
* /mkdir: invalid parameters (line 3, script56)
-


The code I have just now is:
Code:
on *:TEXT:*:# {
  if ($me == no-nick) {
    if !$exists("C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\ $+ $network $+ \ $+ $chan $+ \ $+ $asctime($calc($gmt - $duration(0hrs)),dd.mm.yy)") { /mkdir "C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\ $+ $network $+ \ $+ $chan $+ \ $+ $asctime($calc($gmt - $duration(0hrs)),dd.mm.yy)" }
    if ($chan != #no-nick) { write "C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\ $+ $network $+ \ $+ $chan $+ \ $+ $asctime($calc($gmt - $duration(0hrs)),dd.mm.yy) $+ \ $+ index.htm" <br> $1- }
  }
}


Thanks, and sorry for the bother.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Since you have multiple directory levels that you are using, you have to check that each level exists, and if that level doesn't exist, then you have to use /mkdir for each level

eg:
"C:\Documents and Settings\Sean's\My Documents" probably exists due to the method that Windows uses to create the My Documents folder.
However, the sub-directory Web might not exist, so you need to check if it does exist or not, and if it doesn't, then create that directory.
Then you have to do the same thing for:
Logs
networks
$network
$chan
and whatever the date response that you get for the calculation you have at the end.

P.S.: You can shorten your calculation for the date response by using $gmt(dd.mm.yy) as the calculation of $gmt - $duration(0 hrs) is going to return $gmt

Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
Ok, thank you very much Russel smile


Link Copied to Clipboard