Fwd: Too simple to find an answer for...
Fwd: Too simple to find an answer for...
- Subject: Fwd: Too simple to find an answer for...
- From: Bernardo Hoehl <email@hidden>
- Date: Thu, 29 Jul 2004 17:42:30 -0300
I expected a "sum" or summarize to be a reserved word.
This is what I was using:
set Result01 to 0
repeat with i from 1 to the count of MyNumberList
set Result01 to Result01 + (item i of MyNumberList)
end repeat
I thought I was being just too clumsy doing this...
Thanks!
Begin forwarded message:
>
From: Andrew Oliver <email@hidden>
>
Date: 29 de julho de 2004 17h33min46s GMT-03:00
>
To: Bernardo Hoehl <email@hidden>, Applescript Users
>
<email@hidden>
>
Subject: Re: Too simple to find an answer for...
>
>
And just what do you expect this script to do?
>
>
The 'summarize' command takes a block of text and tries to extract the
>
relevant content to a summary that highlights the important parts of
>
the
>
document. It has no effect on a list of integers.
>
>
If what you're trying to do is sum (i.e. add) all the integers, you'll
>
either need to loop through them, or use some OSAX that can do it for
>
you
>
(without checking, I'm guessing the Satimage OSAX will do this 0- it
>
does
>
just about everything else ;) )
>
>
on getSum (theList)
>
set theSum to 0
>
repeat with eachItem in theList
>
try
>
set theSum to (eachItem as number)
>
end try
>
end repeat
>
return theSum
>
end getSum
>
>
Andrew
>
:)
>
>
On 7/29/04 12:36 PM, "Bernardo Hoehl" <email@hidden> wrote:
>
>
> I searched for apple's subroutines and my O'Reilly's Applescript book,
>
> and can't find an answer to this very simple one:
>
>
>
> set MyNumberList to {5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2}
>
>
>
> set x to the summarize of every item of MyNumberList --- error
>
>
>
> Thanks!
>
>
>
> Bernardo Hoehl
>
>
>
> Rio de Janeiro - Brazil
>
> _______________________________________________
>
> applescript-users mailing list | email@hidden
>
> Help/Unsubscribe/Archives:
>
> http://www.lists.apple.com/mailman/listinfo/applescript-users
>
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.