mIRC Home    About    Download    Register    News    Help

Print Thread
#143581 26/02/06 07:17 AM
Joined: Mar 2003
Posts: 32
P
Pap Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2003
Posts: 32
It turns out that if you have a text file that has been formatted with whitespace and you use the /play command, the whitespace formatting is retained when it is sent to the server.

So far, my efforts to use a script to write whitespace to the file have failed. The closest I've gotten was using the /bwrite command directly from the command line, which worked, but the same command from inside a script did not work.

Any gurus have any suggestions on how to write extra whitespace to a file?

P.S.: I know about the $chr(160) trick and I'm trying to avoid it.

#143582 26/02/06 07:30 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Just a suggestion, try:

//write moo.txt $+(Moo,$chr(9),Moo!)

-Andy

#143583 26/02/06 03:22 PM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
you sure /bwrite inside the script didnt work?

Code:
 bset &a 1 32 32 32
 bwrite file.txt -1 -1 &a


tested.. adds 3 spaces to the end as it should :>


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
#143584 26/02/06 07:25 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
white space should be maintained if you are using just /play filename speed

while I have not tested all the switches using play -c filename.txt has always truncated multiple spaces to one space

one solution (other than character 0160) is to use ctrl+k or ctrl+o
mated pair with spaces:

//say $chr(15) $chr(15) $chr(15) $chr(15) $chr(15) .
try that

#143585 26/02/06 09:51 PM
Joined: Mar 2003
Posts: 32
P
Pap Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2003
Posts: 32
jaytea, my data is actually coming from a %var, so I'm presented with the problem of converting my var into asc without losing the extra whitespace. Please note that the amount of whitespace padding is always created dynamically, based off of other variables.

example:

var %rowdata = %rowdata $eval($var(%rowdata.*, %f),2)) $+ $str($chr(160),%diff)

and that is actually inside a white loop as it goes through each row's column.

#143586 26/02/06 10:01 PM
Joined: Mar 2003
Posts: 32
P
Pap Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2003
Posts: 32
One possible workaround might be to write my stuff to a temp file using $chr(160) as padding as usual, and then run a "script" or something from inside mIRC that goes in and replaces all instances of chr(160) with chr(32). Something like a $com script rather than /run an external program, but I really don't know anything about these $com scripts.

#143587 26/02/06 10:44 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
while (loop to get all row) {
  var %rowdata = $+(%rowdata $eval($var(%rowdata.*, %f),2)),$str($chr(32),%diff))
}
var %rowdata = $+(%rowdata, $crlf)
bwrite filename.txt -1 -1 $(%rowdata,)


A variable can contain multiple spaces following one another, some times u might loose them depending on how you join other things to the end, thus my use of $+(part1,part2) over part1 $+ part2 (although i dont think it was strictly needed.
I didnt add anything else to the loop, just showed it to infer your repeating untill you have the line built ready for writing to the file.
I added a $crlf to the end of the line for the file as well since bwrite JUST writes what ya tell it.

Heres the bit thats odd, the BWRITE if u used %rowdata on its own, it gets expanded by mirc into its contents, and all the extra spaces get swallowed. so you need to tell mirc to evaluate this zero times $eval(%rowdata,0) or the shortened version $(%rowdata,). Now mirc just leaves that as %rowdata, and the /bwrite command goes, Oh ok ill write the contents of %rowdata out to the file, along with all them spaces!

#143588 27/02/06 12:21 AM
Joined: Mar 2003
Posts: 32
P
Pap Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2003
Posts: 32
That looks like it should work, but for some reason the whitespace is still being trimmed. (btw, I'm using 6.12 if it matters.)

But I have good news!!

I figured out a workaround. I padded my data with $chr(160) as I have always been doing, but instead of writing/echo'ing %rowdata each time, I sent it off to this alias:

Code:
alias RBgetnewasc {
  var %d = 1
  while (%d <= $len($1-)) {
    var %ascdigits = %ascdigits $asc($mid($1-,%d,1))
    inc %d
  }
  return $replace(%ascdigits,160,32)
}


And just did this:

Code:
bset &rowdata 1 $RBgetnewasc(%rowdata) 13 10
bwrite gettabletemp.txt -1 -1 &rowdata


May not be the most efficient solution, but it works so I'm stickin' to it!

I wish to thank everyone who participated in this thread. +1 karma points for you all.

#143589 27/02/06 07:08 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
That looks like it should work, but for some reason the whitespace is still being trimmed. (btw, I'm using 6.12 if it matters.)


maybe its 6.12 but....
I would suggest using my method and just prior to writing the %rowdata out do a ///echo -st rowdata = $replace(%rowdata,$chr(32),$+($chr(32),$chr(2),$chr(2)))
This should show u if at some point you have caused the white spaces to be removed, before you wrote the data out, it simply replaces each space with a space bold bold which well allow all the spaces to be displayed in a /ECHO

ON your code you can do this...

bset -t &rowdata 1 $+(%rowdata,$crlf)
breplace &rowdata 160 32
bwrite gettabletemp.txt -1 -1 &rowdata

Which is also a useable method (and can have a far longer %rowdata), but means u cant have a $chr(160) in the source data, as it would be replaced (same problem in your code)


Link Copied to Clipboard