mIRC Home    About    Download    Register    News    Help

Print Thread
#197008 27/03/08 04:22 AM
B
Buggs2008
Buggs2008
B
Hello,

I was trying to write to a text file some information, but it seems when combined with an editbox for some reason, the output does not show returns/spacing between text.

Example:
Code:
on *:DIALOG:tlogger:sclick:15: {
  var %n = %nick | var %p = $did(12).text | var %s = $did(14).text | inc %x
  write " $+ $scriptdir $+ info.txt" $+(%x,$chr(124),%n,$chr(124),%p,$chr(124),%s) 
}


output in txt file:
1|Buggs2008|problem1 line1|solution1 line1

---------------------------------------------
Given in editbox1:
---------------------------------------------
problem1 line1

problem2 line

---------------------------------------------
Given in editbox2:
---------------------------------------------
solution1 line1

solution2 line2


Any thoughts or suggestions?

Thanks a bunch

#197010 27/03/08 04:35 AM
Joined: Aug 2004
Posts: 7,168
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
1) You don't have the character code for blank lines being written to the text file, so there's nothing to tell mIRC that there are supposed to be blank lines in the output.
1a) Use $crlf to give a blank line
2) The usage of $chr(124) will show as the | character, unless the p switch is used in the $read identifier.
From the help file
Quote:
If the p switch is specified, command | separators are treated as such instead of as plain text.


#197011 27/03/08 05:02 AM
B
Buggs2008
Buggs2008
B
Is there anyway to grab everything inside a did(15).text ?

even if theres a space in between lines? and output it ?

Something like a while loop?

var %a = 1
while (%a <= $did(12).text ) {
write " $+ $scriptdir $+ info.txt" %a
dec %a
}

Last edited by Buggs2008; 27/03/08 05:12 AM.
#197024 27/03/08 09:29 AM
Joined: Feb 2006
Posts: 523
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 523
a while loop through $did(12,%a) from %a = 1 to $did(12).lines, that way you can handle each line individually, and refer to the %a-th lines of other editboxes too

or $didtok(12,C) where C is the ASCII value of the line separator. eg. $didtok(12,32) returns all the lines separated by $chr(32), a space. i don't think you'll find much use for $didtok() here, but it's worth knowing


Link Copied to Clipboard