mIRC Homepage
Posted By: DJ_Sol /write -i - 18/10/09 12:45 AM
Hi

I've never really used the write command much, but I'm working on a script where I want to insert a line into a file. It seems pretty straightforward but the text always gets put in the last line of the file.

At first I made the line dynamic.

var %li_ = $lines(file.txt) - 1
write $+(-i,%li_) file.txt Testing

This should write the line "Testing" to the second to last line in the file, but it always puts it in the last line.

I;ve tried a static line number.

/write -i5 file.txt Testing

This writes to the last line as well...


Whats going on? What am I missing?
Posted By: Horstl Re: /write -i - 18/10/09 12:53 AM
-l indicates that you provide a line position; -i is only for insert (and not overwrite). Use both switches, like in the example
Originally Posted By: /help /write
/write -il5 c:\info.txt This line will be inserted at the 5th line in the file


Posted By: DJ_Sol Re: /write -i - 18/10/09 12:54 AM
oh lol I didnt even see the l >.< thanks!
© mIRC Discussion Forums