First, I am not a programmer. I worked years as a computer engineer and retired. Help will be greatly appreciated and thank you in advance. I have the feeling, I just miss a small part of how to get the array coordinates rights.
I need to do something very simple. It is a two steps process. The first one is reading from a simple flat file. The lines will always be in the format A,B,C:
1234,1234 A Street,CP
5678,5678 B Street,HW
9012,9012 C Street,CP
Then I will build a simple GUI with 1 button per line (caption will be first parameter) and a two text captions on the right side of the button (Address and address type). The GUI can be build while reading.
1 - I can read the line into Word-Array with no issue.
2 - I know it is StrSplit(Word_Array[Line],",") that I need to use to split the string, but I was never able to make it work right.
Code: Select all
Word_Array := []
Line := 1
MaxLineArray := 0
Loop
{
FileReadLine, Str1, E:\Input1.txt, %Line%
if ErrorLevel = 1
Break
Word_Array[Line] := Str1 ;<----- problem one: StrSplit(Word_Array[Line],",") here but I do not know how to set it up
Line++
} ;<--- I assumje this end loop will be brought down somewhere to dynamically generate the buttons.
; Problem 2: How do I generate the code between the ;***** to generate the buttons? I do not care if the window is too big. I will give it space to generate 20 buttons that will be the maximum.
Gui, New
;Gui, Add, Picture, x1 y1 w300 h420 vMyPicture, %CPath%Writing.jpg
;*****
Gui, Add, Button, x320 y100 vOpt1, Button1
Gui, Add, text, x380 y100 vSometext1, Text here
Gui, Add, text, x400 y100 vSometext2, Text here
;*****
Gui, font, s14, Arial
Gui, Add, Button, x590 y550 Default gOK, OK
Gui, Add, Button, x645 y550 Default gCancel, Cancel
Gui, Show
return
OK:
Gui, Submit
;My code will be here
Cancel:
Gui, Hide