Re: Getting the name of a file from an "alias"
Re: Getting the name of a file from an "alias"
- Subject: Re: Getting the name of a file from an "alias"
- From: Jan Pieter Kunst <email@hidden>
- Date: Tue, 12 Jun 2001 22:41:16 +0200
Guy Parker (email@hidden) schreef op 12-06-2001 17:04 :
>
> alias "Disk:folder1:folder2:file"
>
>
>
> How do I get just the name of the file (in the above case "file") into a
>
> string?
>
>
>
>
Try passing your variable x to this...
>
>
on GetFileName(this_filepath)
>
--This routine from Apple's essential subroutine library
>
set this_filepath to this_filepath as text
>
set x to the offset of ":" in (the reverse of every character of
>
this_filepath) as string
>
return ((characters -(x - 1) thru -1 of this_filepath) as text)
>
end GetFileName
I didn't use this for the name of the file (it was more convenient to tell
the Finder to provide me with the name of the alias) but I did use your
technique to split the filename in name and extension. Thanks for the tip.
JP