Code: Select all
on preopencard
setup_
open file specialfolderpath("desktop") & "/mydata.txt" for read
read from file specialfolderpath("desktop") & "/mydata.txt" until eof
put it into tHighscores
put tHighscores after fld output
close file specialfolderpath("desktop") & "/mydata.txt"
sort_
end preopencard
on setup_
put empty into fld "output"
put empty into fld "output2"
end setup_
on sort_
put fld "output" into MyVariable
set the itemdel to tab
split MyVariable by lf and tab
sort lines of MyVariable descending numeric by item 2 of each
repeat with loop = 1 to the number of lines of "MyVariable"
Put MyVariable[loop] into line loop of field output
end repeat
end sort_
I can't get the lines of "MyVariable" to be sorted and re-displayed in the field "output".
N.B.
- The output (text) field has been named "output".
- tHighscore needs to be used to put data into the field one score at a time, I've attempted to have all data stored in it as an array from the .txt file on my desktop but for some reason, the scores aren't saving after one another and are instead only saving one at a time