Hello,
I'm trying to update a listbox from a text file.
I read the text file then try to guicontrol the listbox. The problem is the carriage returns aren't being registered when populating the listbox. It's showing as one line in the listbox.
gui, 3:add, listbox, r20 w200 vattenlist
fileread, readallatten, %userprofile%\managertools\attendance\allatten.txt ;(this file is in a list format)
sort, readallatten, N R
guicontrol, 3:, attenlist, %readallatten%
Any help is appreciated? Probably something simple I'm overlooking.
OMG lisbox making me crazy. Help please. Topic is solved
-
- Posts: 4
- Joined: 24 Jan 2017, 15:30
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: OMG lisbox making me crazy. Help please.
Hi.
Maybe it is an encoding problem. Try to save allatten.txt in UTF-8 format.
The help says:
Maybe it is an encoding problem. Try to save allatten.txt in UTF-8 format.
The help says:
So try the *t parameter like:*t: Replaces any/all occurrences of carriage return & linefeed (`r`n) with linefeed (`n)
Code: Select all
fileread, readallatten, *t %userprofile%\managertools\attendance\allatten.txt
Einfach nur ein toller Typ.
Re: OMG lisbox making me crazy. Help please. Topic is solved
List element/items have to be seprated with "|"
if aallatten.txt looks like following
then this can be done via loop parse
or
stringreplace
if aallatten.txt looks like following
Code: Select all
Item1
Item2
Item3
Item4
Item5
Item6
Item7
Item8
Item9
Code: Select all
fileread, readallatten, %userprofile%\managertools\attendance\allatten.txt ;(this file is in a list format)
Loop, parse, readallatten, `n, `r
readallatten_List := readallatten_List "|" A_LoopField
Gui add, listbox, r20 w200 vattenlist, %readallatten_List%
Gui Show
return
stringreplace
Code: Select all
fileread, readallatten, %userprofile%\managertools\attendance\allatten.txt ;(this file is in a list format)
StringReplace, readallatten_List, readallatten, `n, |, all
Gui add, listbox, r20 w200 vattenlist, %readallatten_List%
Gui Show
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
-
- Posts: 4
- Joined: 24 Jan 2017, 15:30
Re: OMG lisbox making me crazy. Help please.
Thank you both! I ended up with the following
sort, readallatten, N R
Loop, parse, readallatten, `n, `r
readallatten_List := readallatten_List "|" A_LoopField
guicontrol, 3:, attenlist, %readallatten_List%
sort, readallatten, N R
Loop, parse, readallatten, `n, `r
readallatten_List := readallatten_List "|" A_LoopField
guicontrol, 3:, attenlist, %readallatten_List%