I believe this is a fine-tuning nightmare as the placement in your gui is dependent on the font and the (variable) space each character takes in the gui. So, it's dependent on your resolution, your font type, your font size, your dpi scaling. You might get it working on your system, but someone else on theirs will see gobbledygook (that's a professional term!
) . I got a decent result using the script below, but only if all elements on one row are of the same size and a mono-spaced font.
You'll have a much better chance trying to format it this way using HTML.
Code: Select all
file := A_ScriptDir "\test0000.txt", z := 3, cnt := 1, yy := 5
fileread, fl, % file
while % cnt
fl := strreplace(strreplace(fl,"`r`n", " ",, z-1),"`r`n", "`n",cnt, 1)
gui, font, s13, consolas ;Lucida Sans Typewriter
for x,y in strsplit(fl, "`n")
{
xx := 100 - strlen(Strsplit(y," ").1) * 4.8 ; found the 4.8 conversion factor using trial and error...
gui, add, text, x%xx% y%yy%, % Strsplit(y," ").1
xx := 200 - strlen(Strsplit(y," ").2) * 9.6
gui, add, text, x+%xx% y%yy%, % Strsplit(y," ").2
xx := 200 - strlen(Strsplit(y," ").3) * 9.6
gui, add, text, x+%xx% y%yy%, % Strsplit(y," ").3
yy += 20
}
gui, show, w600
- 20220628_140015.jpg (27.65 KiB) Viewed 565 times