Wrong result after adding up to extracted numbers.
Wrong result after adding up to extracted numbers.
- Subject: Wrong result after adding up to extracted numbers.
- From: Manuel <email@hidden>
- Date: Mon, 27 Feb 2012 22:49:35 +0100
Hello, scripters.
Using this script I extract the numbers of the text file, add up a value to those numbers, but I don´t get the right sum.
set LibretaCampo to paragraphs of (read alias "LionRetail:Users:macdiario:Desktop:Artola2.txt") set AppleScript's text item delimiters to "," set Puntos to LibretaCampo as string set AppleScript's text item delimiters to "" set AppleScript's text item delimiters to "," set ListaPuntos to text items of Puntos set AppleScript's text item delimiters to ""
set CotasExtraidas to {} repeat with i from 4 to the count of ListaPuntos by 5 set the end of CotasExtraidas to text item i of ListaPuntos end repeat
set numerossumados to {} repeat with i from 1 to the number of items in CotasExtraidas set cifra to ((item i of CotasExtraidas) + 1.25) set end of numerossumados to cifra end repeat
Extracted numbers: {"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"}
Result after adding up 1.25 to the extracted numbers: {4955.25, 2935.25, 4179.25, 7218.25, 5325.25, 5753.25, 6172.25, 7161.25, 6895.25, 9711.25, 9162.25, 8557.25, 7300.25, 6999.25, 1.001125E+4, 1.095025E+4, 1.013525E+4, 9989.25, 9676.25, 5092.25, 3974.25}
The right numbers should be: 6.204, 4.184, etc.
What´s wrong ? Thanks. |
1002,571.459,503.186,4.954,BASE
1,611.842,532.764,2.934,MURO
2,597.912,512.581,4.178,MURO
3,582.439,490.231,7.217,MURO
4,579.149,492.434,5.324,MURO
5,569.663,478.826,5.752,MURO
6,572.999,476.555,6.171,MURO
7,614.352,528.675,7.160,CASA
8,610.944,524.419,6.894,CASA
9,609.364,504.184,9.710,CASA
10,603.294,502.879,9.161,CASA
11,604.762,495.292,8.556,CASA
12,595.776,493.284,7.299,CASA
13,589.518,492.041,6.998,CASA
14,592.006,479.742,10.010,CASA
15,593.720,471.034,10.949,CASA
16,590.469,465.125,10.134,CASA
17,595.968,461.543,9.988,CASA
18,594.465,460.350,9.675,BOR
19,565.782,479.436,5.091,BOR
20,556.024,484.955,3.973,BOR
_______________________________________________
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