Le 18 déc. 2009 à 19:39, Paul Berkowitz a écrit : That sounds as if you have a localized version of Excel which uses different punctuation in formulas, but AppleScript doesn't know about it. You're probably set in OS X International prefs to use the comma (not period) as decimal point. In your version of Excel that may trigger the "punctuation" separating elements in formulas and functions to be semicolon rather than comma - or it may be set like that always. (I've never heard of this before.) There's no preference for this behavior, at least not in the US version of Excel. Check Excel Help for COUNTIF and other formals - does it show the semicolon as the separator within the parentheses? Is this true in both Excel 2004 and 2008? Anyway, AppleScript is evidently not localized and just knows the US version. If you can tell me which localized version of Excel you have (or which country you bought it in) and confirm that it uses the semicolon in 2008 in formulas, I'll make inquiries. It's some sort of bug.
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.
When I write scripts for spreadsheets, I take care of that with a simple handler which return the used delimiter.
--===== (* Returns the parameter delimiter which must be used in Numbers formulas *) on getLocalizedDelimiter() if character 2 of (0.5 as text) is "." then return "," else return ";" end if end getLocalizedDelimiter
--=====
So I am able to build formulas matching the local requirements.
I don't know for Excel 2008 but I know spreadsheets whose functions names are localized : Excel v5.x, openOffice, neoOffice, AppleWorks, Numbers
For Numbers I grabs the localized functions names with these simple handlers :
--===== (* Useful to get function's localized name if we need to build formulas examples: set OFFSET_loc to my getLocalizedFunctionName("Numbers", "OFFSET") set ADDRESS_loc to my getLocalizedFunctionName(theApp, "ADDRESS") set INDIRECT_loc to my getLocalizedFunctionName(theApp, "INDIRECT") *) on getLocalizedFunctionName(theApp, x) local p2bndl set p2bndl to (path to application support as text) & "iWork '09:Frameworks:SFTabular.framework:Versions:A:Resources:" return my getLocalizedName(theApp, x, p2bndl) end getLocalizedFunctionName
--=====
on getLocalizedName(a, x, f) tell application a to return localized string x from table "Localizable" in bundle file f end getLocalizedName
--=====
Yvan KOENIG (VALLAURIS, France) vendredi 18 décembre 2009 21:09:12
|