I’m having trouble understanding how to enter a number in a dialog box, then assign that to a variable, and then have that be the number of times an action is to be carried out.
Can anyone offer some advice or refer me to a tutorial that might cover this?
repeat
set theNumber to text returned of (display dialog "Enter a number" default answer 1)
try
set theNumber to theNumber as integer
exit repeat
on error
display dialog "I said: Enter a NUMBER" buttons {"Try Again!"}
end try
end repeat
repeat theNumber times
-- do something
end repeat
I’ve had to tinker a bit, but this is working great now!
Thanks so much for your help. I can now automatically carry out a really mundane set of keyboard commands that would otherwise take me ages to complete.