mIRC Home    About    Download    Register    News    Help

Print Thread
#249614 07/12/14 06:24 PM
Joined: Jul 2006
Posts: 4,149
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2006
Posts: 4,149
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
I came across this thread https://forums.mirc.com/ubbthreads.php/topics/164216//filter_addition#Post164216n which itself links to this https://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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2006
Posts: 4,149
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard