Add together all numbers in a list
Hi all,
I'm still learning Applescript and am stuck on something I imagine is relatively simple!
I have a script that cycles through all the graphic frames in my document and records their widths and heights to a list.
--outside of the loop
set fWList to {}
set fHList to {}
--inside the loop
set frameWidths to (d - b)
set end of fWList to frameWidths
set frameHeights to (c - a)
set end of fHList to frameHeights
--at the end of the script, verify values
{fWList, fHList}
Its this last bit I'm stuck on, I don't know how to work with the list given. These will always be numbers and I need to sum all the numbers recorded
if fWList is 500, 500, 500 I need 1500 saved to a variable called totalWidths
if fHList is 300, 500, 500 I need 1300 saved to a variable called totalHeights
I've tried everything and just get errors at the last moment, the errors do show '500,500,500' etc so I know the info is being collected properly, I just can't get it back out!
Thanks