Re: alias file types
Re: alias file types
- Subject: Re: alias file types
- From: Kai <email@hidden>
- Date: Sun, 23 Feb 2003 14:34:13 +0000
on Sat, 22 Feb 2003 12:16:16 -0500, Paul Skinner <email@hidden>
wrote:
>
Aliases don't seam to have a creator type or file type and also they
>
aren't sure what class they are. Here the finder says it's a class
>
'alias' but the alias says 'disk'.
>
>
set f to alias "titan:"
>
tell application "Finder"
>
{class of f, class of (get (properties of f))}
>
end tell
>
-->{alias, disk}
There can be some confusion over the term 'alias', Paul.
Generally, an AppleScript alias record works in a similar way to an alias
file (which is a Finder object). They both identify another file or folder -
even after the original has been moved and/or renamed.
However, to check the class of a Finder file, you'll first need to coerce it
from an AS alias record to a Finder object (which may or may not be an alias
file).
In fact, by coercing an AppleScript alias record to references, we can see
the underlying difference between AS and Finder objects:
==============================
set f to alias "Macintosh HD:"
f as reference
--> alias "Macintosh HD:" of <<script>>
tell application "Finder" to f as reference
--> alias "Macintosh HD:" of application "Finder"
==============================
So, to check the class of an alias file, just turn it into a Finder
reference first:
==============================
set f to alias "Macintosh HD:"
f's class
--> alias
tell application "Finder" to (f as reference)'s class
--> disk
==============================
Of course, if the alias record happens to refer to an alias file, you'll get
something like this instead:
==============================
set f to alias "Macintosh HD:Macintosh HD alias"
f's class
--> alias
tell application "Finder" to (f as reference)'s class
--> alias file
==============================
--
Kai
_______________________________________________
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.