mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2003
Posts: 9
G
GoldenH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: May 2003
Posts: 9
I got sick of having a thousand log files .1 .2 .3 .4 .99 whatever so I wrote this little script. Obviously it goes into your Remotes section. Let me know if you see any obvious problems.

on 1:START:{
:begin
var %text $findfile($logdir,*.1.log,1)
if (%text) {
var %text $left(%text,-6)
copy -a " $+ %text $+ .1.log $+ " " $+ %text $+ .log $+ "
remove " $+ %text $+ .1.log $+ "
goto begin
}
}

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
So then, is there any particular problems you are having or are you posting code for people to use? If it's the latter then it should be posted on websites such as mIRC.net, mIRC Scripts.org or Hawkee.com.

Joined: May 2003
Posts: 9
G
GoldenH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: May 2003
Posts: 9
I am posting it because

- There might be some issues I have not forseen. For example, even though I have my log files configured to put the server name into the filename, sometimes I get a log file with no server name in it. Not sure why this happens but maybe something similiar will happen when it gets tried out. I did this in about 10 minutes and I haven't slept in ages so, who knows what will happen.

- There are several threads about this issue and hopefully the script one can be linked to instead of just telling people to wait for the next version. I just decided to post it here instead of in one of the threads.

- There are likely to be some questions about how to install the script and so I can answer them quickly if it has its own thread.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Not to bash your script, but it is horribly inefficient. You should search this forum for posts regarding $findfile. You should also view the mIRC help file section about $findfile, specifically the 'command' parameter.

-genius_at_work

Joined: May 2003
Posts: 9
G
GoldenH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: May 2003
Posts: 9
Hm, ok but then I have to put part of it in Aliases, right?
Too bad there isn't a /move command. But this code makes me sad even if it is more efficent because I can't put it all in remotes frown

on 1:START:{ noop $findfile($logdir,*.1.log,0, startup $1- ) }

/startup {
var %text $left($1-,-6)
copy -a " $+ %text $+ .1.log $+ " " $+ %text $+ .log $+ "
remove " $+ %text $+ .1.log $+ "
}

Last edited by GoldenH; 20/07/07 08:22 PM.
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Yes you can.

Code:
on 1:START:{ noop $findfile($logdir,*.1.log,0, startup $1- ) }

alias startup {
  var %text $left($1-,-6)
  copy -a $+(",%text,.1.log,") $+(",%text,.log,")
  remove $+(",%text,.1.log,")
}

Joined: May 2003
Posts: 9
G
GoldenH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: May 2003
Posts: 9
I know about the alias prefix, but I avoid using it since otherwise it would be hard to find all the aliases.

I guess if I use the -l switch, it could only be accessed by stuff in ini file it is in. If I put it in its own ini file, it shouldn't cause too much trouble.

Last edited by GoldenH; 20/07/07 09:30 PM.
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Personally, I find it more of a nuissance to have to search through several files/tabs to find code that is related to the same script. At this point, I have 0 aliases in the alias tab of the scripts editor.

If you put all the code in one file, you can easily post the script on a webpage without having to provide detailed instructions about which parts go in which locations.

-genius_at_work

Joined: May 2003
Posts: 9
G
GoldenH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: May 2003
Posts: 9
of course, but now the name "startup" is claimed by that script, so I have to put everything related to the script in its own file so that if I want to use that name again, it doesn't cause a problem.

I find it much easier to scroll down a bit through Aliases than go to the View menu and choose the right file.

And I assume that if I were to put two on START events in the same file, or even more than one on START event at all, it would cause problems? Last time I tried to use on INPUT more than once, it would only trigger the first event of the type. Maybe there's something on that front i'm missing, though.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You could just trick out mIRC:

Code:
on *:START:if ($findfile($logdir,*.1.log,0,$($(.copy -a $qt($1-) $qt($replace($1-,.1.log,.log)),0) $chr(124) $(.remove $qt($1-),0),1)) > 0) echo -st Startup: Merged $v1 temporary log $iif($v1 == 1,file,files)



-genius_at_work

Joined: May 2003
Posts: 9
G
GoldenH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: May 2003
Posts: 9
... evil.

I'll have to play around with that and figure out why it works. or how it is even possible...

Quote:
$(...)

This identifier can only be used in the text match section of an event definition.

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
It says that but $() works pretty much anywhere $eval() works.


Link Copied to Clipboard