Posts: 4
Threads: 1
Joined: Nov 2011
I need to get the last 5 text lines, from something like this:
http://pastebin.com/raw.php?i=1B27wjfX
I need it to get the last 5 lines, so it out's:
WETYWTGG
45235TFH
EHRJF
HRTHYRT5
HFHFH6
More text would be added so I need it to get the last 5 lines regardless of what the last lines contain.
Would be great if you could help!
Posts: 12,147
Threads: 143
Joined: Dec 2002
Macro
Macro1581
str s=
;aaaa
;bbbbbbb
;cccccc
;dddddddd
;eeeeeeee
;ffffffff
;gggggggg
;hhhhhh
int n=numlines(s)
if(n>5) s.getl(s n-5 2)
out s
Posts: 4
Threads: 1
Joined: Nov 2011
Gintaras Wrote:Macro Macro1581
str s=
;aaaa
;bbbbbbb
;cccccc
;dddddddd
;eeeeeeee
;ffffffff
;gggggggg
;hhhhhh
int n=numlines(s)
if(n>5) s.getl(s n-5 2)
out s
Thanks that helped a lot, now I'm having an issue with adding the list to my Listbox.
I've tried using:
LB_Add id(6 hDlg) s
But it doesn't add a linebreak in the list and displays as: WETYWTGG45235TFHEHRJFHRTHYRT5HFHFH6
Instead of:
WETYWTGG
45235TFH
EHRJF
HRTHYRT5
HFHFH6
Any help?
Posts: 863
Threads: 197
Joined: Apr 2005
You can use:
[...]
str line
foreach line s
,LB_Add id(6 hDlg) line
[...]
Posts: 4
Threads: 1
Joined: Nov 2011
Lucas Wrote:You can use:
[...]
str line
foreach line s
,LB_Add id(6 hDlg) line
[...]
Thanks a bunch bro, works perfectly!
Edit: Is there any way of refreshing the LB so all text in the list is removed from the dialog?
Posts: 863
Threads: 197
Joined: Apr 2005
SendMessage(id(6 hDlg) LB_RESETCONTENT 0 0) ----> remove all items from listbox.
Posts: 4
Threads: 1
Joined: Nov 2011
Lucas Wrote:SendMessage(id(6 hDlg) LB_RESETCONTENT 0 0) ----> remove all items from listbox.
Thanks for your help man!