mIRC Home    About    Download    Register    News    Help

Print Thread
#9873 06/02/03 02:21 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
i was looking in the help on the /write command and came up with

/write nicks.txt text to be written

and by using the -l switch and a # i can write to a certain line but what i want to do is actually add a new line at the bottom moving the last line down one ? any ideas

a example
nicks.txt

nick1
nick2
nick3
nick4
nick5

i want to write the new line to line 5 and at the same time move line 5 to line 6

thx in advance smile

#9874 06/02/03 02:30 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
write -il5 nicks.txt new text for line 5


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#9875 06/02/03 03:10 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
ok yep i see that is thier now i was interpreting it wrong in the help file but now i have another problem it doesnt seem to work if i want to write to line #66 and i am trying to set a
%var to equal that value is that possible here is what i have
Code:
 

alias w {
  set %j $lines(nicks.txt)
  set %jj $calc(%j - 1)
  set %newnick $me
  /write -il $+ %jj nicks.txt %newnick 
}

  


i also tryed just using /write-il%jj without the $+
but it didnt work either

thx in advance

#9876 06/02/03 03:36 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
write $+(-il,$calc($lines(nicks.txt) - 1)) nicks.txt $me


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#9877 06/02/03 03:51 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
hmm that still doesnt write to the file i am using mirc5.91 and the nicks.txt is in the main mirc folder is there something else i am missing ?

#9878 06/02/03 04:13 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
That command works for me. It adds my nick to the second to the last line (which is what the $calc() does for you). If you mean that it doesn't write to the line before the last line, omit the $calc( - 1) and just use

write $+(-il,$lines(nicks.txt)) nicks.txt $me


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#9879 06/02/03 04:17 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
nope i mean it isnt writing to the file at all ? is the problem from calling it from an alias ? by typing /w i am trying to get it to write to the second to last line in the file but nothing at all happens ? also is the full path required like c:\mirc\nicks.txt ?
thx again for the help smile

if i change it to a popup file it will write to the file but it writes to the third to last line rather than the second which is not a problem really but will it work from an alias instead ?

Last edited by Cheech; 06/02/03 04:21 AM.
#9880 06/02/03 04:25 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Try changing the name of the alias from /w to /ww .. you might have another /w alias that's conflicting. The command itself obviously works since it works from a popup (and from the command line, since I typed it to test it).


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#9881 06/02/03 04:29 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
ahhh doh thats why /w is allready used in the alias file also one last question will the changes to the file be saved after each time you write to it ?
thx

#9882 06/02/03 05:01 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Yup. That's kind of the point of /write. :tongue:


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard