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
|