best way to do fast arithmetic operations on lists?
best way to do fast arithmetic operations on lists?
- Subject: best way to do fast arithmetic operations on lists?
- From: Christian Prinoth <email@hidden>
- Date: Thu, 16 Dec 2010 16:25:38 +0100
Hi, I am trying to read a list of numbers from excel, then add a number to each element of the list, and write back the result, as follows:
tell application "Microsoft Excel"
if date 1904 of active workbook is true then
set delta to 693960 + 1462
else
set delta to 693960
end if
set mldates to value of selection
repeat with i from 1 to length of mldates
repeat with j from 1 to length of item i of mldates
set item j of item i of mldates to (item j of item i of mldates) - delta
end repeat
end repeat
set value of selection to mldates
set number format of selection to "dd/mm/yyyy"
end tell
Unfortunately this becomes very slow for large arrays, I guess the script sticks inside the loops. Is there any way to make this faster, eg. something like
set mldates=mldates+1?
Thanks
Christian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden