mIRC Homepage
Posted By: DJ_Sol Dialog: Retrieving multiple lines in edit box - 25/02/08 02:06 AM
Hello, I have an advertiser dialog with an edit box that you can enter your message in.

edit "", 4, 2 40 216 60, multi autovs vsbar return

If I use $did(4) it only returns the first line so I use $didtok(4,32). The issue is if a line is wrapped to the next line, $didtok(4,32) inserts a space there. So if they have a long link, it will insert a space where the text gets wrapped to the next line. If I use $didtok(4,44) it returns with a space AND a comma. ($chr(44))

Does anyone know how I can retrieve all the text in my multi-line edit box correctly?

here is an example of my edit box and a very long link.



This is what $didtok(4,32) returns. Notice the spaces in the link making the link broken.

Quote:
Testing a long link.... http://www.wasdvdfjnbdfbdfbdhbvdf-dfdfdfbvff.com/cgfds g/sdfgsdfg/dsfgdsfgdfg/df/sdfgdsfgdsfg/dsfgdfsg/dfg/gfd/dfs gdsfgdfsg/dfgdfsgdf/dfgdfgdf/gfdgdfgdfgdf



Thank You!
You can just use a token separator that cannot be in text, like LF (linefeed character), then remove it from the result:

$remove($didtok(4,10),$lf)
right, but even when I do not use "32" in didtok, it adds a space, so $didtok(4,44) returns ...


Quote:
Testing a long link.... ,http://www.wasdvdfjnbdfbdfbdhbvdf-dfdfdfbvff.com/cgfds ,g/sdfgsdfg/dsfgdsfgdfg/df/sdfgdsfgdsfg/dsfgdfsg/dfg/gfd/dfs ,gdsfgdfsg/dfgdfsgdf/dfgdfgdf/gfdgdfgdfgdf
No this might sound silly but if its adding a space doesnt a % or something fill it in?
Or use a while loop

Code:
var %x 1
while (%x <= $did($dname,ID).lines) {
var %editbox = %editbox $+ $did($dname,ID,%x)
inc %x
}


%editbox would have the contents of the editbox
The biggest problem you'll have is when you WANT a space that happens to be at the end before the line is split. Using $+ will likely remove it if it's at the end of the line before it wraps.
Yes Riamus that is my concern.

Also, I don't think writing a whole if statement to handle urls in an edit box should be an option. I would think mIRC already handled this considering it's an edit box.

Looking at this I can't believe that this is an issue with mIRC. I was thinking I was doing something wrong or didn't know how to do it right. It's hard for me to think that this is just an issue with mIRC as the issue is so basic. I mean if you are going to provide an edit box with the ability for multiple lines how could you allow a space between each line.

This is why I figured I may have messed something up in the control parameters or missed something. Is this a bug that should be reported?
I cannot reproduce that behaviour here; spaces are not automatically appended to each line. I tested with an editbox created with the exact same options as yours.

Are you using the latest version of mirc? Are you sure that the editbox is not already populated by lines ending with a space?
Yes I am using the latest mirc. This happens on every computer that uses this dialog not just mine. The text is a link. There are no spaces in the link. The edit box is initially blank. The space shows up where the line gets wrapped to the next line regardless of what the text is.

Please show me the edit box parameters and identifier you use to retrieve the long url without getting spaces where the line wraps.

Thank You.

Code:
dialog test {
  size -1 -1 150 100
  edit "", 1, 0 0 150 100, multi autovs vsbar return
}

  • Type /dialog -m test test
  • Type some stuff in editbox (making sure they wrap)
  • Type //echo -ag $remove($didtok(test,1,10),$lf)
© mIRC Discussion Forums