• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
best way to do fast arithmetic operations on lists?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: best way to do fast arithmetic operations on lists?
      • From: Paul Berkowitz <email@hidden>
    • Re: best way to do fast arithmetic operations on lists?
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: SUL up and running again!
  • Next by Date: How do you eval strings as enumerators in 10.6?
  • Previous by thread: Re:How to keep PhotoShop CS4 Save for Web plug-in from truncatingfilenames to 32 chars
  • Next by thread: Re: best way to do fast arithmetic operations on lists?
  • Index(es):
    • Date
    • Thread