On 12 Mar 2017, at 19:51, Maik Waschfeld < email@hidden> wrote:
I saw on different messages in this list, that the AppleScripts start with some keywords like
What Yvan said is correct, but not the whole story. Here’s another way of looking at it:
If you’re copying a script from here or elsewhere that includes those statements, they probably need to be there. But if you’re writing your own original scripts, you don’t need ANY of those statements in your script unless:
i. the applescript version statement is needed if your script includes code that was not available before Yosemite. If you’re not using ASObjC* in your script, you almost certainly won’t need the minimum version statement (and if you don’t know what ASObjC code is, then you won’t need it). However, to be sure, you can check the AppleScript Language Guide (there’s a link to that in the Help menu of Script Editor).
ii. the framework** statement needs to be included if you’re using ASObjC code that uses APIs from from one of Apple’s frameworks, such as the “Foundation” framework.
iii. you’ll need the ‘use scripting additions’ if you have any other ‘use’ statement at the beginning of your script. Normally, scripting additions are loaded automatically (no, you don’t need to install them)*** except when there’s a use statement at the beginning of the script. In that case, you have to explicitly add the ‘use scripting additions’ statement.
*ASOjbC code is special code that calls Apple’s main APIs collectively known as ‘Cocoa’ using a special syntax that’s a creole of AppleScript and Objective-C. Until recently (last few years), very few AppleScripts used this kind of code. Most scriptures would consider using ASOjbC ‘advanced scripting’.
*** none of the use statements you referred to require you to install anything. It’s all stuff on your system. However, there are other use statement that can be used to call 3rd party libraries, scripts etc which may have to be installed, or may have been installed by some other software.
Best
Phil |