Solved!Problem with repeat command...probably my fault..
Posted: Thu Apr 12, 2018 9:34 pm
Hi again,
i have a problem with my script... it's a little problematic.... the repeat go in loop forever!!!don't stop when finish the lines in the field...tha i would expet me....
Target:
i need to found some text in a field ...if exist i find the number of items founds....if the result don't give nothing...then answer " Nothing item found....if found something text then backgroundcolor to green the text found....
that's all...
i thank you a lot in advance to everybody,
Best regarsds,
Lestroso
i have a problem with my script... it's a little problematic.... the repeat go in loop forever!!!don't stop when finish the lines in the field...tha i would expet me....
Target:
i need to found some text in a field ...if exist i find the number of items founds....if the result don't give nothing...then answer " Nothing item found....if found something text then backgroundcolor to green the text found....
that's all...
i thank you a lot in advance to everybody,
Best regarsds,
Lestroso

Code: Select all
global ttrova
global x
global numerolinee
global conta
on mousedown
put 0 into conta
get the number of lines in field "result"
put it into numerolinee
put field "trova" into ttrova
send "cercatesto" to me
end mousedown
on cercatesto
repeat with x = 1 to numerolinee
subtract 1 from numerolinee
if numerolinee = 1 then answer "okkkkk" <------this don't work i don't know why!!!!
if numerolinee = 1 then pass cercatesto <------this don't work i don't know why!!!!
find ttrova in field "Result"
if the foundtext is ttrova then
add 1 to conta
select the foundtext
set the backgroundColor of selectedtext to "green"
else
answer "I Have Found " & conta & " Items!"
pass cercatesto
else
if the foundtext is not ttrova then
answer " I don't have found nothing!!"
pass cercatesto
end if
end if
end repeat
end cercatesto