Re: Finder - getting file type
Re: Finder - getting file type
- Subject: Re: Finder - getting file type
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 22 Dec 2004 23:55:44 -0800
Title: Re: Finder - getting file type
On 12/22/04 11:40 PM, "DizzyPenguin" <email@hidden> wrote:
Is there anyone that can tell me why the below first snippet would *randomly* fail (on a OSX 10.3.7 system) while the second one doesn't, while choosing the same file?
-- start
set x to choose file
tell application "Finder" to set y to file type of x
--end
-- start
set x to choose file
set x to info for x
tell application "Finder" to set y to file type of x
--end
The second one doesn't need to be in a Finder tell block at all. In this case 'file type' is on of the properties of the 'file information' record result of 'info for'. All you need is
set y to file type of (info for (choose file))
and that's preferable. I the first case you ought to be able to get the file type Finder property but we all know the Finder is apt to be wonky at times. I've never known it to fail on 'file type', mind you. Still if you find it does, use 'info for'.
Also try
set x to choose file as Unicode text
tell application "Finder" to set y to file type of file x
(I.e. use 'file' rather than alias.) Also try System Events using 'file' like this. (System Events will definitely not work using 'alias'.)
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden