Re: loading scripts from a relative path?
Re: loading scripts from a relative path?
- Subject: Re: loading scripts from a relative path?
- From: Shane Stanley <email@hidden>
- Date: Mon, 27 May 2013 08:35:05 +1000
On 27/05/2013, at 6:51 AM, Alex Hall <email@hidden> wrote:
> 1. If I use Finder, is there really much of a performance hit, or am I worried about nothing?
If you're doing it once or twice, it's mostly not worth worrying about. But if the Finder is busy doing something else, there can be a delay -- in some case considerable. It doesn't strike me as worth the bother when there's an easy alternative.
> 2. If Finder is a bad idea to use that often, how else could I get the relative path to the script?
>
> Yes, I can write a load function that grabs "path to me", breaks it up by colons, then gives me all but the last (thereby giving me "path to me" without the script name) but that's hardly reusable.
Why is it not reusable? That's precisely what most people use.
> I'll do that if I have to, and leave that handler in every script, but a native solution would be cleaner and, I suspect, a bit faster.
I'm not sure how you can compare the speed of something that doesn't exist, but you may well be surprised how little time using text item delimiters to do the job takes. Judging the speed of AS code by appearances will lead you up the garden path very quickly.
--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
_______________________________________________
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