• 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: 2551phil <email@hidden>
  • Date: Sun, 12 Mar 2017 21:42:46 +0700


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’. 

**Frameworks are whole bunches of code lumped together that perform related or dependent functions. You can learn more about them here: https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemFrameworks/SystemFrameworks.html

*** 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
 _______________________________________________
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: Question on keywords
      • From: Maik Waschfeld <email@hidden>
References: 
 >Question on keywords (From: Maik Waschfeld <email@hidden>)

  • Prev by Date: Re: Write an antislash (backslash) in a variable ?
  • Next by Date: getting info about the selected even in Calendar
  • Previous by thread: Re: Question on keywords
  • Next by thread: Re: Question on keywords
  • Index(es):
    • Date
    • Thread