Re: Path string interpretation with 'as alias'
Re: Path string interpretation with 'as alias'
- Subject: Re: Path string interpretation with 'as alias'
- From: Nigel Garvey <email@hidden>
- Date: Thu, 19 Jun 2003 00:16:09 +0100
Emmanuel wrote on Wed, 18 Jun 2003 17:29:36 +0200:
>
At 3:49 PM +0100 18/06/03, Nigel Garvey wrote:
>
> try
>
> pathString as alias
>
> on error
>
> -- The folder doesn't exist
>
> end try
>
>
>
>I want it to run on any system and to differentiate between files and
>
>folders, but it seems that the behaviour of 'as alias' has changed
>
>between 9.2.2 and 10.2.6 with regard to how rigidly trailing colons are
>
>observed:
>
>
I would have said that I have not the problem that you say, but I rather
>
use:
>
>
> try
>
> alias pathString
>
> on error
>
> -- The folder doesn't exist
>
> end try
Coercion and specification behave exactly the same way in this respect on
my machines. In 10.2.6 it doesn't matter if pathString ends with a colon
or not. An alias is produced anyway, whose representation on screen ends
with a colon if the aliased item *is* actually a folder, and not if it
isn't. In 8.6 and 9.2.2 it does matter. If the style of the path string
doesn't agree with the class of the existing item, there's an error when
trying to make an alias. It would be useful for my purposes if this were
also the case in X - though as I said, I now have a workaround that
should serve until Mac OS XI comes out. (In my script, 'pathString'
always ends with a colon.):
try
file pathString as file specification
on error
-- The folder doesn't exist or it's a file
end try
I suppose another all-system approach might be:
try
if alias pathString as string is not pathString then error
on error
-- The folder doesn't exist or it's a file
end try
>
Of course sooner or later you hit the problem of packages, which are files
>
whose path ends with colon.
Oh yeah. :-\ I may look into those tomorrow....
Thanks for your reply. :-)
NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.