Is there an applescript command to round a number to the nearest whole number?
Yes
set x to 4.567
set y to x as integer
Best wishes
John M
Certainly.
{round 6.4, round 1.5}
--> {6, 2}
There are various rounding options that you can check out in the Standard Additions dictionary:
I believe the ability to coerce a real to an integer was introduced in Panther - so be aware that earlier system versions will trip over it.
If you merely wish to round a number down, you could also use the ‘div’ function (which is faster than rounding):
{6.4 div 1, 1.5 div 1}
--> {6, 1}
thanks for all the help