 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Conquer-NLI Guest
|
Posted: Fri Mar 19, 2010 12:32 am Post subject: Simple Question: Working with new lines in a script |
|
|
Hello there, I'm trying to first count the number of lines in a GUI edit control, and then replace the topmost line if there is over 6 lines.
Here is my code:
| Code: |
gui,submit,nohide
stringreplace,test,status,`r`n,,A
result := errorlevel
if result > 6 ; more than 6 lines, out of space, erase the top line
{
parsing := status
status =
pastfirstline = false
loop, parse, status
{
if a_loopfield = `n
pastfirstline = true
if pastfirstline = true
status .= a_loopfield
}
} |
The problem is that the script doesn't seem to recognize `r`n as a new line (so the result is never higher than 6), if I check the script's variable debugger, the result seems to be 0 found each time. I've tried lots of things in place of `r`n but can't seem to get it to work. |
|
| Back to top |
|
 |
OceanMachine
Joined: 15 Oct 2007 Posts: 780 Location: England
|
Posted: Fri Mar 19, 2010 12:41 am Post subject: |
|
|
Are you sure there is actually a new line character that you are looking for in your Edit control? A normal multi-line edit control will wrap text onto multiple lines, even if there are no newline characters at all in it...
How/why are you limiting to 6 lines (are you trying to for the text to fit on your gui or something like that?) |
|
| Back to top |
|
 |
NLI-Conquer Guest
|
Posted: Fri Mar 19, 2010 12:47 am Post subject: |
|
|
Nvm I figured it out. I was missing the "UseErrorLevel" switch in the last parameter. And yeah its so I can fit the right amount of messages into a small edit control.
Thanks sin_tax |
|
| Back to top |
|
 |
sin_tax Guest
|
Posted: Fri Mar 19, 2010 3:23 am Post subject: |
|
|
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|