Get file name from alias

: There are several simple ways of getting what you want. You might
: try this for a start…
: info for ( fileAsAlias
: as string )'s name Andreas
:
Sometimes I’m really a long way from the solution…
Jean-Baptiste LE STANG

: Sometimes I’m really a long way from the solution…
: Jean-Baptiste LE STANG
You weren’t so far away, Jean-Baptiste, the idea of getting the text after the last “:” is perfectly sound and very common. However, the more conventional way of doing that would be:

set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
try
    set fileName to (theFileAsAlias as string)'s last text item
    set AppleScript's text item delimiters to oldDelim
on error errTxt
    set AppleScript's text item delimiters to oldDelim
    display dialog errTxt
end try

fileNameA note for you, Tom, and two caveats. Try both methods and make your choice. Be careful, though:

  1. Don’t use the first method with a disk as the object or you will think your computer has frozen ‘info for’ a disk takes a while!
  2. Don’t use method 2 without the ‘try - on error’ construct; leaving the delimiters to anything but the default could cause you strange problems.
    A nice thing about these two methods is that they both work in or not in a Finder tell statement.
    Also, Tom, once you have investigated ‘info for’ you could - if you have Akua installed - go on to see what ‘basic info for’ and ‘extended info for’ have to offer - not for the present task, but just for learning.
    Andreas