Firstly, this will sound stupid because of the nature of the question but trust me; if this was as easy as it should be then I wouldn't be here.
Here's the problem:
I want to move the data from a text field (an output field used to display text (names) and positive integers (scores)) into an array so that it can be sorted and searched.
I assumed it would be as easy as "put the text of fld "output" into myArray" but I was wrong.
When I do this (after checking the "variables" tab on the coding screen) no variables or arrays are created and the sort/search algorithms don't function as they should.
This process works at another stage in my program where I took the score from a text box to be used as a variable. Even on copying and pasting the code (while amending variable names) the code isn't working.
Any help would be particularly useful and I would be extremely grateful as this is the last stage of a long process of creating this software.
Here's my exact code:
Code: Select all
Local tName
Local tLines
Local templine
Local tScores
on mouseUp
put empty into fld "output2"
put the text of fld "output" into tScores
ask "Please enter the name you wish to find:"
put it into tName
repeat with loop = 1 to the number of lines of tScores
put line loop of tScores into tLines
split tLines
if item 1 of tLines[loop] = tName then
put "The name" && tName && "was found on line" && loop into field "output2"
else
put "The name" && tName && "could not be found!" & CR & "Please make sure you have entered the name correctly" &CR& "or try searching for another name." into fld "output2"
end if
end repeat
end mouseUp