• 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
Using frameworks explicitly (was Re: AppleScriptObjC oddity solved - kinda)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using frameworks explicitly (was Re: AppleScriptObjC oddity solved - kinda)


  • Subject: Using frameworks explicitly (was Re: AppleScriptObjC oddity solved - kinda)
  • From: Chris Page <email@hidden>
  • Date: Sun, 12 Jul 2015 18:38:06 -0700


On Jun 24, 2015, at 7:28 AM, Steve Mills <email@hidden> wrote:

Adding 'use framework "Foundation"' didn't help it.

I don't have a suggestion for your issue, but I want to take a moment to stress that one must always explicitly "use" frameworks one's scripts make use of; otherwise, those scripts aren't guaranteed to work. If your script is using frameworks without requesting them, the script is relying on the host process having loaded the framework your script needs, which can change from process to process or in future versions of a program. (e.g., Script Editor and osascript are host programs, and Script Editor loads frameworks that osascript does not.)

Also, AppleScript could change in the future such that frameworks that are not explicitly requested may not be available even if they are used by the host.

Also also, note that if a framework explicitly makes another framework available to its clients, it should be okay to not explicitly "use" the other framework(s). But, just because a framework uses another framework does not necessarily mean that that other framework is also available to clients—it depends on how intermediate frameworks are built. Specifically, it should be fine to only "use" the Cocoa framework and then make use of AppKit and Foundation, since the Cocoa framework is specifically designed to make them available to clients, but you probably shouldn't rely on most frameworks making Foundation available to you. It will never be wrong to explicitly "use" a framework you're making use of.

-- 
Chris Page
The other, other AppleScript Chris

 _______________________________________________
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

  • Prev by Date: MacScript from Excel 2016 fails to source bash_profile
  • Next by Date: Re: AppleScriptObjC oddity
  • Previous by thread: MacScript from Excel 2016 fails to source bash_profile
  • Next by thread: Re: AppleScriptObjC oddity
  • Index(es):
    • Date
    • Thread