• 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
convert a script to 10.9
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

convert a script to 10.9


  • Subject: convert a script to 10.9
  • From: "koenig.yvan" <email@hidden>
  • Date: Sun, 27 Oct 2013 15:08:05 +0100

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


 _______________________________________________
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

  • Follow-Ups:
    • Re: convert a script to 10.9
      • From: Shane Stanley <email@hidden>
  • Prev by Date: path to applications folder in 10.9
  • Next by Date: Re: path to applications folder in 10.9
  • Previous by thread: Re: path to applications folder in 10.9
  • Next by thread: Re: convert a script to 10.9
  • Index(es):
    • Date
    • Thread