Write

From Scriptwiki
Revision as of 08:55, 2 July 2007 by Cail (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Writes or removes lines to/from a textfile.

/write [-cidna l# s# w# r#] <filename> [text]


Explanation of the switches:

Switch Meaning
c clears the file completely before writing to it
i indicates that the text should be inserted at the specified line instead of overwriting it.
d deletes a line in the file.
n prevents it from adding a $crlf to the end of the text.
a indicates that mIRC should append the line of text you specified to the existing text of the specified line.
l# specifies the line number where the text is to be written.
s# scans a file for the line beginning with the specified text and performs the operation on that line.
w# scans a file for the line containing the specified wildcard text and performs the operation on that line.
r# implies a regex match.

Note that with both -s# and -w# you can enclose the scan text in quotes if it contains spaces. /write store.txt This line will be appended to the end of file store.txt

Note that you cannot use this command to write to an INI file. If you do so, you will most likely corrupt the INI file. Take a look at /writeini to write to an ini-file.

Example

write moo.txt Hello!

This example would just write Hello! to the moo.txt in your mircdir.


write -c moo.txt Hello!

Also this example would write Hello! to your moo.txt but with clearing it before.


write -il2 moo.txt This is my new line2!

This would insert This is my new line2! at line 2 in moo.txt.


write -w bla moo.txt blub

This would search for the line with bla in it and write blub to it.

See Also