ok, I was wondering if there is any way that when the user enters text in a prompt and hits ok, if the text isn’t a number/numbers a prompt comes up telling them that they are only allowed to type numbers and goes then goes back to the original prompt? help is appreciated
Perhaps something like this, hendo:
to input_number(p, v, i)
set v to text returned of (display dialog p default answer v with icon i)
try
if (count v) > 0 then return v as number
end try
beep
input_number("The entry must be a number:", v, 2)
end input_number
input_number("Please enter a number:", "", 1)
Why use an if statement and count command when the coercion can throw an error itself?
try
return v as number
end try