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
|