Hello
Here is a handler which I used before 10.9 but which no longer compiles: on switchCheckBox(d, s, t, r, c) tell application d to tell document d to tell sheet s to tell table t to tell cell r of column c set oldVal to «class NMCv» «event NmTbCLR » set {«class NMCv», «class NMCT»} to {not oldVal, «constant NMCTfcch»} end tell end switchCheckBox
I tried to edit it so that it works under 10.9 I extracted the code from the handler and, as it didn't compile as is, I replaced d by the name of the application and this time it compiles as :
tell application "Numbers" to tell document d to tell sheet s to tell table t to tell cell r of column c set oldVal to value clear set {value, format} to {not oldVal, checkbox} end tell
As the new Numbers can't be driven by AppleScript I try to edit my scripts so that they don't trigger the new app but use the old one. So I edited it as :
set Numbers09 to (path to applications folder as text) & "iWork '09:Numbers.app" tell application Numbers09 to tell document d to tell sheet s to tell table t to tell cell r of column c set oldVal to value clear set {value, format} to {not oldVal, checkbox} end tell
It refused to compile until I hardcoded the path to the application:
set Numbers09 to POSIX path of ((path to applications folder as text) & "iWork '09:Numbers.app") tell application "/Applications/iWork '09/Numbers.app" to tell document d to tell sheet s to tell table t to tell cell r of column c set oldVal to value clear set {value, format} to {not oldVal, checkbox} end tell
As you see, this time I use the Unix path to the app because with that, the script may be used on a machine whose boot volume is not named "Macintosh HD" like mine.
Is the need to use a hardcoded path a normal behavior ? On my side I believed that it's not because when I try to drive the application's cousin Pages, I may code :
set Pages09 to (path to applications folder as text) & "iWork '09:Pages.app" tell application Pages09 to tell document 1 count paragraphs end tell
but hardcoding is required for other properties. This new one refuse to compile if I code tell application Pages09…
set Pages09 to (path to applications folder as text) & "iWork '09:Pages.app" tell application "/Applications/iWork '09/Pages.app" to tell document 1 count paragraphs font name of character 1 of body text end tell
Clearly, I have a scheme which works but I'm really puzzled.
Yvan KOENIG (VALLAURIS, France) dimanche 27 octobre 2013 15:07:58
|