Re: loading scripts from a relative path?
Re: loading scripts from a relative path?
- Subject: Re: loading scripts from a relative path?
- From: Alex Hall <email@hidden>
- Date: Sun, 26 May 2013 18:45:58 -0400
On May 26, 2013, at 6:35 PM, Shane Stanley <email@hidden> wrote:
> 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.
True, I hadn't considered what would happen if the Finder is busy. That is a serious concern, as I imagine users will particularly like the CPU and ram scripts when they are doing long tasks... at least the geeky ones will. :) I love finally having that information so I can keep an eye (well, not an eye, I suppose an ear) on my system's vitals.
>
>> 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.
Reusable was a poor choice of words. I know the function will be several lines long, and I was hoping for a single, native command to do the job. It's just my reluctance to reuse code ten or fifteen times coming out - when I see a single function used over and over and over, I want to share it where it needs to go, not copy it, but in this case I really don't have a choice, I suppose. After all, I can't very well share a function that facilitates the sharing of functions...
>
>> 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
Have a great day,
Alex (msg sent from Mac Mini)
email@hidden
_______________________________________________
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