• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting the name of a file from an "alias"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the name of a file from an "alias"


  • Subject: Re: Getting the name of a file from an "alias"
  • From: Guy Parker <email@hidden>
  • Date: Tue, 12 Jun 2001 16:04:34 +0100

> Let's say I have an variable x in my script that is set to an "alias". So,
> the value of x is:
>
> 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

Guy.


  • Follow-Ups:
    • Re: Getting the name of a file from an "alias"
      • From: Jan Pieter Kunst <email@hidden>
  • Prev by Date: Determining Whether File In Use in System 8.6
  • Next by Date: Re: applescript-users digest, Vol 2 #751 - 11 msgs
  • Previous by thread: RE: Getting the name of a file from an "alias"
  • Next by thread: Re: Getting the name of a file from an "alias"
  • Index(es):
    • Date
    • Thread