Le 19 déc. 2009 à 18:41, Paul Berkowitz a écrit : On 12/18/09 12:09 PM, "Yvan KOENIG" <email@hidden> wrote: Why describe this behavior as a "kind of bug" ? It's the logical behaviour to accomodate the fact that in some countries, the decimal separator is the comma. Given that, the apps can't use the comma as parameters delimiter. The "sort of bug" is that the AppleScript implementation of Excel is not accommodating itself to the localized syntax, and uses the comma rather than the semicolon. I guess if it did so, it could cause other problems such as preventing international distribution of scripts. (I.e. you couldn't write a version of a script that would work everywhere.) So maybe the current method is best after all – although it still seems problematic to me. If there really are some functions and formulas where you can use a literal number (e.g. 4,5 where comma is the decimal point) rather than a column-row-cell range (A5) as one of the parameters - this is the only situation where using comma as parameter delimiter could cause a problem - then how do you avoid the problem in AppleScript? I'm a bit dubious that there could be such a situation: surely you don't use literal numbers - constants - as parameters? When would the comma-as-parameter-delimiter be misinterpreted as a comma-as-decimal-point in a number? Can you think of an example? For example, in your own script, using the comma is what works. But, OK, given that you need ";" in the UI due to a genuine possibility of conflict and confusion, won't you get that conflict and confusion using "," in a script - in some contexts? In AppleScript a formula is text, in double quotes. I suppose that if a literal number used within a formula has to use a period "." as decimal point (if we ignore the fact that it's within quotes and treat it as we do real numbers in AppleScript) , and you remember to do that also in your scripts, you can avoid confusion. But that's the issue: if you can think of some example that uses a literal number as a formula parameter, do you use a period or a comma for it within the quoted formula in AppleScript?
I use daily scripts which insert formulas in spreadsheet tables. I'm forced to take care of the accepted syntax. If I want that a script may be used worldwide (as most of those which I write trying to help users on Apple's discussions forum), this requires the use of the localized functions name and the use of the local delimiter.
Here is an example taken in a script building a transposed table:
(* builds this kind of formula =IF(ISBLANK(OFFSET(B2,7,0)),"",OFFSET(B2,7,0)) *) repeat with i from 1 to nbRows repeat with j from 1 to nbColumns set value of cell (colNum1 - 1 + i) of row (rowNum1 - 1 + j) to "=" & IF_loc & ISBLANK_loc & OFFSET_loc & sourceSheet & " :: " & sourceTable & " :: " & sourceCell & delim & i - 1 & delim & j - 1 & "))" & delim & quote & quote & delim & OFFSET_loc & sourceSheet & " :: " & sourceTable & " :: " & sourceCell & delim & i - 1 & delim & j - 1 & "))" end repeat end repeat
In French the formula is : =SI(ESTVIDE(DECALER(B2;7;0));"";DECALER(B2;7;0))
If I don't build exactly this formula, I get, in the target table, the infamous red triangle flagging a syntax error. It's also an example of the bad job done by the guys building the localized versions. In French we must write DÉCALER, not DECALER. This was reported several times but Apple is deaf and continue to distribute a wrong set of resources. Happily, I am able to correct these resources. So, I work with an application which use correctly my language. This is one of the reason why I used a word which hurt some ones here: apartheid. It's boring to see that Apple ask to competent guys the task of building English versions but ask to employees ignoring foreign languages to build foreign versions. I studied the complete set of menu items used in iWork components. It's really awful. Even a Frenchman ignoring 13 languages among the 15 delivered may discover oddities in these versions (except eastern ones).
Yvan KOENIG (VALLAURIS, France) samedi 19 décembre 2009 19:50:52
|