mIRC Homepage
Posted By: LonDart Why doesn't this rename work? - 27/02/07 01:27 AM

I wrote a script that filters extraneous lines out of my log files, and it works fine.

My logs are saved as mircdir\logs\network\#channel.date.log

I filter from the log file to a text file, which is then renamed to mircdir\logs\network\#channel.date.txt

I thought I'd prefer to have it renamed as mircdir\logs\network\#channel.date.log.txt
but I can't get it to work.

This:

Code:
//echo -s $+(%chlog,.txt)


returns mircdir\logs\network\#channel.date.log.txt

But this:

Code:
/rename filtchlog.txt $+(%chlog,.txt)


still returns mircdir\logs\network\#channel.date.txt

While being able to do this is truly unimportant, I would love to know if I am missing something,
or if this is a bug, or what.

Posted By: RusselB Re: Why doesn't this rename work? - 27/02/07 03:09 AM
You have to double evaluate.
Use /rename filthlog.txt $($+(%,chlog,.txt),2)

This is one of those things that you don't find out about until you try. Personally I don't think it's a bug, but then again I can see your point.
Posted By: LonDart Re: Why doesn't this rename work? - 27/02/07 06:27 AM
Thanks RusselB.

I guess I never thought of evaluation, because the offline echo worked without it.

I played with quoting and unquoting, but not the double evaluation. That's part of the fun of
scripting, I guess; having to think of everything. smile
Posted By: LonDart Re: Why doesn't this rename work? - 27/02/07 09:45 PM
Well, it turns out that the problem was the quoting and unquoting.

The script sets the %chlog variable to the full path to the log, with quotes, then calls
a text file that plays to the filter command and renames the temporary file.

The reason my playing around with the quoting and unquoting wouldn't work was dopey me
never changed the path to the text file in the script, so it never saw the new commands. blush

Details, details.
© mIRC Discussion Forums