Thanks thierry for this tip !Thierry wrote: ↑Tue Feb 23, 2021 9:44 amCode: Select all
put 0 into fld "IFA" repeat with N=1 to the number of fields in group "gFields" if fld N of group "gFields" is empty then put N into field "IFA" exit repeat end if end repeat
I didn't know how to create a "loop"


I have just modified Thierrys code by adding the word "field"before of N ...


@trags, I've only tested it on 3 empty/full fields (as on picture) but its efficient where ever the first empty field is.
Code: Select all
on mouseUp pButtonNumber
put " " into field "IFA"
put 0 into numero
repeat with numero=1 to 3 # Modify 3 with your real number of fields..7?"
put "field"&numero into combinedfield # Combining each Numero to create each field's names
if field combinedfield is empty then
put " EXEC.f:"&numero after field "IFA"
# do your magic for IFA here
break # stops once empty field is found
else
# line below can de deleted if no action is required
put " skip f:"&numero after field "IFA"
end if
end repeat
end mouseUp
