mIRC Home    About    Download    Register    News    Help

Print Thread
#192556 04/01/08 06:07 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I am trying to /write the contents of /ulist protect to a text file. However, when I try to do so, the resulting file merely contains the text "/ulist protect" instead of the information resulting from /ulist protect. My question is, how to I write information fron a /command to a file instead of writing the text of the command to a file?

I am currently getting around this problem with:

Code:
  if (1 <= $ulist(*,protect)) { /write -c C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,1) }
  if (2 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,2) }
  if (3 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,3) }
  if (4 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,4) }
  if (5 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,5) }
  if (6 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,6) }
  if (7 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,7) }
  if (8 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,8) }
  if (9 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,9) }
  if (10 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,10) }
  if (11 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,11) }
  if (12 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,12) }
  if (13 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,13) }
  if (14 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,14) }
  if (15 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,15) }
  if (16 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,16) }
  if (17 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,17) }
  if (18 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,18) }
  if (19 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,19) }
  if (20 <= $ulist(*,protect)) { /write C:\IcyBot2\Scripts\protect_list.txt $ulist(*,protect,20) }

Last edited by Mpot; 04/01/08 06:23 PM.
Mpot #192557 04/01/08 06:27 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Well, you could do:
Code:
//window -eh @temp | editbox -n @temp //ulist protect $(|) savebuf @temp ulist.txt $(|) close -@ @temp

...but that's ugly.

You'd be better off using a while loop.

Mpot #192568 05/01/08 04:32 AM
Joined: Jul 2007
Posts: 8
S
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
S
Joined: Jul 2007
Posts: 8
Code:
alias While_Loop {
  var %x = 1
  while (%x <= $ulist(*,Protect,0)) { 
    write -c Location_Here\Protext_List.txt $ulist(*,Protext,%x) 
    inc %x
  }
}


hope this helps =)

Last edited by synedyne; 05/01/08 04:32 AM.
synedyne #192569 05/01/08 04:52 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
It is bad form to use an identifier in the condition statement of a while loop, because it is evaluated everytime it loops to the top. You should do something like this instead:

Code:

alias While_Loop {
  var %x = 1, %xx = $ulist(*,Protect,0)
  while (%x <= %xx) { 
    write -c Location_Here\Protext_List.txt $ulist(*,Protext,%x) 
    inc %x
  }
}



-genius_at_work

genius_at_work #192609 06/01/08 02:39 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
So there is really no way to get the /write to put the data from the command in the file instead of the command without doing something like this?

Mpot #192615 06/01/08 04:11 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
No.

-genius_at_work


Link Copied to Clipboard