Hi cooper_tim13 - you seem to be getting stuck with syntax so the following code might help (it probably won't do exactly what you want as I don't know exactly what you want to do). Please note that when I tested this I had fields named "Field_1_6" through to "Field_6_6"
A couple of things to note, try to keep use of globals down if you can (unless you are disciplined in how you name and use them they can cause hard-to-trace bugs), note the use of the 'repeat with' construct (I could have also used 'repeat for' but 'repeat with' is simpler in this case...), note how string literals are mixed with variables, and finally, note the use of brackets when constructing a field's name - what happens if you remove the brackets and do you know why?
Code: Select all
on mouseUp
put "appeal" into finalword
put the len of finalword into lettersinword
repeat with position = 1 to lettersinword
if char position of finalword = "a" then
put "A" into field ("Field_" & position & "_" & lettersinword)
else
put "B" into field ("Field_" & position & "_" & lettersinword)
end if
end repeat
end mouseUp
One last thing, are you by any chance storing each instance of the letter "a" in the various fields? If so then if you use 'into' when placing the letter it will overwrite what is already in the field, if you want to add the letter to what is there you need to use 'after' which will leave what is in the field intact and add the letter after it's contents...
Kind regards
Dave
cooper_tim13 wrote:Hello, thankyou for the replies. However, I am still confused as to how to fix my problem..
Would someone please write up my code again with the variables included in the string? Thankyou.