Re: Does "rounding" work in OS 9.2.1
Re: Does "rounding" work in OS 9.2.1
- Subject: Re: Does "rounding" work in OS 9.2.1
- From: Nigel Garvey <email@hidden>
- Date: Thu, 1 Nov 2001 00:08:47 +0000
<email@hidden> wrote on Wed, 31 Oct 2001 12:11:48 -0600:
>
I'm putting together a little script to add selection sizes in the Finder. I
>
just need a rounded integer for the size. I can't get the rounding script
>
addition to work. It is in there that I checked. This compiles fine.
>
>
set theSizeTotal to 0
>
tell application "Finder"
>
activate
>
set theSelections to every item of selection
>
repeat with theItem in theSelections
>
set itemSize to size of theItem
>
set itemSize to (itemSize / 1024 / 1024)
>
set theSizeTotal to (theSizeTotal + itemSize)
>
end repeat
>
round theSizeTotal rounding as taught in school
>
display dialog theSizeTotal - I would like this to end up an integer
>
end tell
'Round' returns a result; it doesn't change the value of your variable.
You have to do that yourself.
set theSizeTotal to (round theSizeTotal rounding as taught in school)
For speed and the avoidance of 'as taught in school' in your script, you
may prefer:
set theSizeTotal to (theSizeTotal div 0.5 - theSizeTotal div 1)
NG