Filter
From Scriptwiki
Revision as of 13:36, 6 December 2005 by Doomie (talk | contribs) (hell, anyone else continues please =))
This command scans lines of text in a window or file and if any of them contain matchtext, they are written out to another window or file which you can then use.
/filter [-asdfkwxnpriocteubglLz] [n-n2] [c s] <infile | dialog id> <outfile | dialog id | alias> [alias] <matchtext>
The explanation of all switches at first:
Switch | Meaning |
a | sorts filtered lines by calling the optional [alias]. The alias is passed two lines in $1 and $2, it must compare these and return -1, 0, or 1 to indicate relative sort order of these lines to each other. |
s | makes the status window the infile. |
d | makes the single message window the infile. |
f | tells mIRC that the infile is actually a file. |
k | indicates that you have specified an <alias> as the output instead of a window name. The alias will be called with the result of each filtered line. |
w | tells mIRC that the infile is actually a window. |
x | excludes matching lines. |
n | prefixes lines with a line number. |
p | wraps the text output in a custom window. |
r | specifies the range of lines n to n2 for filtering. |
i | indicates that you have provided a [dialog id] custom dialog control as the input. |
o | indicates that you have provided a [dialog id] custom dialog control as the output. |
c | clears the output window/file before writing to it. |
t | sorts the output based on [c s], column C using character S as the columns separator. |
e | specifies a descending sort. |
u | specifies a numeric sort. |
b | strips BURK codes when matching text. |
g | indicates that matchtext is a regular expression. |
l | filters from the side-listbox in the first window. |
L | filters from the side-listbox in the second window |
z | retains line colors when filtering between custom windows. |
Note that you can filter blank lines by specifying $crlf for the matchtext.
The $filtered identifier is filled with the number of matches found, if any.
Some important facts about /filter:
- If you specify an window as output, it has to be created first. mIRC will not create one. Contrary to that, mIRC will create files, if they do not exist.
- If no matchtext is specified, all lines with be copied.
- The specied windows / files must be in the correct order (-fw copies from file to window, -wf from window to file).
Example
For some of the examples, you will need:
- a custom window. Open it with /window -e @filtertest
- a text file. Make a blank one with /write -c filtertest.txt
Example 1: Simple copying
; This will copy your entire mIRC.ini in the @filtertest window. filter -fw mIRC.ini @filtertest ; creates another window called @filtertest2, then copies only lines from @filtertest that begin with a open square bracket [. window @filtertest2 | filter -ww @filtertest @filtertest2 [*
; Copies the entire versions.txt to your filtertest window, with clearing it before. filter -cfw versions.txt @filtertest ; Copies all lines with change in it to @filtertest, with clearing it before again. filter -cww @filtertest @filtertest *change*