 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Mon Jul 07, 2008 6:31 pm Post subject: How can I get a loop, parse to ignore or delete blank lines? |
|
|
I am trying to get data from a gui edit box then input a common value at the beginning of every line. The problem I have is that each entry ends with a carriage return, so I end up with a blank line at the end of my list.
Like this.
server1
server2
server3
-->blank line<--
Her is my code.
| Code: | GuiControlGet,servers,,Edit1,
loop, parse, servers, `n, `r
newservers .= "`n" grid "," a_loopfield "," |
This is what I get.
grid1,server1,
grid1,server2,
grid1,server3,
grid1,,
This is what I want.
grid1,server1,
grid1,server2,
grid1,server3,
How can I get it to ignore or delete a blank line? |
|
| Back to top |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Mon Jul 07, 2008 8:27 pm Post subject: |
|
|
Any help?
At this point I would settle for editing the string. I thought I could do it with StringReplace, but I can't figure it out. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Mon Jul 07, 2008 8:29 pm Post subject: |
|
|
you should wait at least a day before bumping your topic. This community is still small enough that there is not always an expert/helper logged in.
| Code: |
GuiControlGet,servers,,Edit1,
loop, parse, servers, `n, `r
If (A_LoopField)
newservers .= "`n" grid "," a_loopfield ","
|
untested _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Mon Jul 07, 2008 9:23 pm Post subject: |
|
|
Got it thanks to member SKAN.
| Code: | GuiControlGet,servers,,Edit1,
loop, parse, servers, `n, `r
{
ifequal,a_loopfield,, continue
newservers .= (( A_Index = 1 ) ? "" : "`n" ) grid "," a_loopfield ","
} |
|
|
| 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
|