Re: Get only the name of the file, instead of the whole path!
Re: Get only the name of the file, instead of the whole path!
- Subject: Re: Get only the name of the file, instead of the whole path!
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 17 Jan 2008 19:01:16 -0500
It's a good policy to always set tid before using them. It is
nevertheless a bad policy not to reset them *after* using them, since
someone else might not follow that first policy. No matter what, if I
set tid and then call a handler, and after that handler returns the
tid are set differently? Somebody's getting hit. Side effects: bad.
Of course, the original "bad" here is making tid a global in the first
place. You should be able to ask for "text items of foo using
delimiter bar" or some such, not required to set (and therefore, to be
well-behaved, reset) some global default. Well, it's not really a
"default" if you can't override it, is it? :)
On 1/17/08, Stockly, Ed <email@hidden> wrote:
> >>> From my point of vue, your soluce may be OK if you are the unique user
> of
> your scripts.
>
> > If you give or sell them to others they may give odd results because the
> user
> may also use other scripts which assume that the TID are in their standard
> status.
>
> I don't believe a script writer should never assume that.
>
> >>> I remember a period where I was fighting with a script and finally
> discovered that a script sent by a more experienced scripter was coded as
> yours
> >>(no, it was not one of yours).
>
> Whew! :) Although I could have told you it wasn't mine, I never save them as
> run only!
>
> >> I finished to discover that the problem was just that when I called my
> script the TID was not the standard one.
>
> That could never happen to me, because whenever I use TID's I never assume
> to know their value. If the script wants the default value, then I set them
> to their default value.
>
> The problem here is not that someone didn't reset the TIDs to their default
> value, the problem was that you were using them without first setting their
> value.
>
> I never set them back to a default setting, but I also recommend this
> construct inside handlers which may be called frequently:
>
> --------
> On DoMyStuff ()
> set oldDelims to AppleScript's text item delimiters
> set AppleScript's text item delimiters to {","}
> --do my stuff here
> set AppleScript's text item delimiters to oldDelims
> Return
> End DoMyStuff
>
> -----------
> hth
> ES
>
> _______________________________________________
> 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
>
--
Mark J. Reed <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