mIRC Home    About    Download    Register    News    Help

Topic Options
#249614 - 07/12/14 06:24 PM breaking /filter -k
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3506
Loc: France
I'd like to be able to break the filter -k call by doing something from the custom alias called (calling /return, probably).
Suprisingly, even /halt doesn't do anything:
Code:
//alias testbreak echo -a $!1- $(|) halt | filter -fk $qt($mircini) testbreak | alias testbreak
This will halt because echo -a fails on empty line, and /filter was changed to halt if the custom alias throws an error (no problem with this)

So, maybe /halt not halting is a bug here, but in any case I think we should be able to break from /filter without breaking a loop or halting the current execution.

An example? Well let's suppose you have an INI file and you want to load a whole section to a custom @window, but you need to modify the actual output line, you can use filter with -r to start matching at the line where the section starts, and keep matching until you find an empty line, I could theorically use the above with :error to halt and hide the error but that doesn't seem like a good practice/idea.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#249818 - 18/12/14 12:12 AM Re: breaking /filter -k [Re: Wims]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3506
Loc: France
I came across this thread http://forums.mirc.com/ubbthreads.php/topics/164216//filter_addition#Post164216n which itself links to this http://forums.mirc.com/ubbthreads.php?ubb=showflat&Number=144263&site_id=1#import

/halt should really be halting the whole execution/scope while /stopfilter or /filter -h would break the current /filter.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#264656 - 27/12/18 10:13 PM Re: breaking /filter -k [Re: Wims]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3506
Loc: France
Bit of a bump.

Since $findfile and $hfind are not halting the whole script execution when /halt is used inside the command parameter, only the $findfile/$hfind, maybe it is consistent that /halt inside the callback alias of /filter does not halt the whole script execution.

But I really want to be able to stop a /filter -k from the alias.

More importantly:
Originally Posted By: qwerty
However, /filter -k doesn't work like that; it goes through the entire infile, caches the results and then loops over those, calling the -k alias. Changing this in /filter would probably require major changes and create other problems. So what the OP wants (/filter not going through all lines in infile) is rather unlikely imo.
While being able to stop the internal reading of the file would be great, it's clearly not possible as mentioned, something like /filter -h would only stop the loop on the cached lines, which would still be much faster than any other workaround.

Edit: of course -h is used now, any letter would do.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top