mIRC Homepage
Posted By: Pap whitespace!! - 26/02/06 07:17 AM
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.
Posted By: SladeKraven Re: whitespace!! - 26/02/06 07:30 AM
Just a suggestion, try:

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

-Andy
Posted By: jaytea Re: whitespace!! - 26/02/06 03:22 PM
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 :>
Posted By: MikeChat Re: whitespace!! - 26/02/06 07:25 PM
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
Posted By: Pap Re: whitespace!! - 26/02/06 09:51 PM
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.
Posted By: Pap Re: whitespace!! - 26/02/06 10:01 PM
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.
Posted By: DaveC Re: whitespace!! - 26/02/06 10:44 PM
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!
Posted By: Pap Re: whitespace!! - 27/02/06 12:21 AM
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.
Posted By: DaveC Re: whitespace!! - 27/02/06 07:08 AM
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)
© mIRC Discussion Forums