• 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
Re: Question on keywords
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on keywords


  • Subject: Re: Question on keywords
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 12 Mar 2017 14:46:18 +0100


Le 12 mars 2017 à 13:51, Maik Waschfeld <email@hidden> a écrit :

Hi People,

I saw on different messages in this list, that the AppleScripts start with some keywords like 

use AppleScript version "2.4" # Yosemite or higher
use framework "Foundation"
use scripting additions

I have no clue, what these keywords actually do.

So:
use AppleScript version „2.4" # Yosemite or higher

If I´ve understood the discussions, this means that the AppleScript runs only on Systems that have installed AppleScript version 2.4 or later. 
Is this correct?

And:
use framework „Foundation"

Is this a restriction, in the meaning of: just use this framework?
Are there other „frameworks“, installed by default or do they have to be installed separately?
Could someone please point me to a resource, where I can learn, what a „framework“ actually is and does?

And last:
use scripting additions

Do I have to install these „scripting additions“ additionally?
Could someone please point me to a resource, where I can learn, what a „scripting addition“ actually is and does?

Thanks in advance!


With kindest regards…
…Maik Waschfeld


use AppleScript version "2.4" # Yosemite or higher

means exactly what is written in the comment.
It would fail if you try to execute it on a mac running an older version of AppleScript.

use framework "Foundation"
is required if the instructions embedded in the script are ASObjC ones triggering a function belonging to the named framework.
It's one of the frameworks stored in "/System/Library/Frameworks/"

Look at Xcode help for details.

use scripting additions
is required every time the script contain a use framework instruction because such one disable the scripting additions.

In better words, here is how Shane STANLEY tell that in Everyday AppleScriptObjC:

The  first line sets the minimum version of Applescript required, in this case the version that ships with Yosemite. The next line tells AppleScript that the script uses AppleScriptObjC, and that Foundation.framework needs to be loaded by the running application. In fact, Foundation will already be loaded by pretty much every application, but this also tells AppleScript to load some extra information, such as the names of the enumerators and constants used by the framework.

There is a side-effect to using a use statement: once you include one, you also need one for scripting additions if you intend to call any commands from them. And it is a good idea, at least when starting out, to include it if you think you might use a scripting addition command at some stage.  


Yvan KOENIG running Sierra 10.12.3 in French (VALLAURIS, France) dimanche 12 mars 2017 14:46:13




 _______________________________________________
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

References: 
 >Question on keywords (From: Maik Waschfeld <email@hidden>)

  • Prev by Date: Write an antislash (backslash) in a variable ?
  • Next by Date: Re: Write an antislash (backslash) in a variable ?
  • Previous by thread: Question on keywords
  • Next by thread: Re: Question on keywords
  • Index(es):
    • Date
    • Thread