Re: how can script bundles store extra stuff?
Re: how can script bundles store extra stuff?
- Subject: Re: how can script bundles store extra stuff?
- From: has <email@hidden>
- Date: Sun, 24 Jul 2005 12:38:08 +0100
Matt Neuburg wrote:
Okay, so to sum up:
>(1) The dictionary entry for "path to resource" is lying. It claims
>explicitly that by default it will look in the script bundle, but that's not
>true. In the case of a script bundle, you must supply explicitly the
>pathname of that script bundle.
ISTR this is the standard deal with Bundle Services: the default bundle is that of the current process, and you have to specify a path for any other.
>(2) "path to me" will get you the pathname of the script bundle, but not if
>you're running from within Script Editor. (I regard this as either a bug in
>Script Editor or darned silly.)
'path to me' is a synonym for 'path to current application'. It's really a bug - 'path to me' is both meaningless and misleading - but Apple are unlikely to change the current behaviour as it'd break lots of existing code.
What you have to remember is that unlike unix scripting languages, which treat the filesystem as just another namespace, the OSA has no knowledge of filesystem at all so there's no way for OSA languages to obtain a file-based OSA script's path from it. (Yes, this is an annoying shortcoming in OSA; feel free to file a feature request on it.)
With old-style applet shells it's not an issue as the executable and script are the same file anyway, thus 'path to current application' automatically gives the desired result. And some OSA client applications provide their own ad-hoc workarounds by intercepting the 'path to current application' event and returning a path to the file from which that script was loaded; it's a total hack and semantically incorrect, but it generally gives the user the value they want.
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden