• 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
Re: Wrong result after adding up to extracted numbers.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong result after adding up to extracted numbers.


  • Subject: Re: Wrong result after adding up to extracted numbers.
  • From: Christopher Stone <email@hidden>
  • Date: Mon, 27 Feb 2012 21:44:31 -0600

On Feb 27, 2012, at 20:49, Manuel wrote:
It works! I also realized that here is Spain we use the comma "," for the decimal numbers, instead of "." that´s why I had the strange results. 
Now, how can I take the results to a new TextEdit Document ?
 ...
but I get a -10000 error, in the Apple Events Manager. 
______________________________________________________________________

Hey Manuel,

It appears to me that you're trying to dump a list object into TextEdit.  It needs text.

set someText to "Now is the time for all good men to come to the aid of their country."
tell application "TextEdit"
set newDoc to make document
set text of newDoc to someText
end tell

Going back to your original problem.

I was wondering why the script failed here on my machine, so I was relieved to know the issue was as simple as the '.' ',' substitution.  :)

One of the many reasons I keep the Satimage.osax on my machine is for its 'statlist' function:

set l to {"4.954", "2.934", "4.178", "7.217", "5.324", "5.752", "6.171", "7.160", "6.894", "9.710", "9.161", "8.556", "7.299", "6.998", "10.010", "10.949", "10.134", "9.988", "9.675", "5.091", "3.973"}

statlist l

{
maximum:10.949, 
maximum index:16, 
minimum:2.934, 
minimum index:2, 
sum:152.128, 
mean:7.24419047619, 
variance:5.259980535147, 
stdev:2.293464744692, 
missing value:0
}

In your original script I noticed a couple of little things:

set AppleScript's text item delimiters to "" --< Unnecessary
set AppleScript's text item delimiters to ","

And:

repeat with i from 4 to the count of ListaPuntos by 5

Although Applescript has sped up so much that this point is really minor now, it's better practice to use the 'length' property of a list rather than the 'count' command.

--
Best Regards,
Chris

 _______________________________________________
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

References: 
 >Wrong result after adding up to extracted numbers. (From: Manuel <email@hidden>)
 >Re: Wrong result after adding up to extracted numbers. (From: Shane Stanley <email@hidden>)
 >Re: Wrong result after adding up to extracted numbers. (From: Manuel <email@hidden>)

  • Prev by Date: Re: Wrong result after adding up to extracted numbers.
  • Next by Date: Re: Gatekeeper
  • Previous by thread: Re: Wrong result after adding up to extracted numbers.
  • Next by thread: Re: Wrong result after adding up to extracted numbers.
  • Index(es):
    • Date
    • Thread