Re: Finder - getting file type
Re: Finder - getting file type
- Subject: Re: Finder - getting file type
- From: DizzyPenguin <email@hidden>
- Date: Thu, 23 Dec 2004 08:43:14 +0000
On 23 Dec 2004, at 07:55, Paul Berkowitz 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,
In my application, I *am* using "as Unicode text", but specifying "item" instead of "file", as shown below:
set existFile_wExt to (
fullPath &
coverName & ".jpg")
as Unicode text
tell application "Finder"
to set fType to (
file type of item existFile_wExt)
This has never caused any problem to any of my customers, except this one who I think may be running a Norwegian OSX system.
I'll try you option(s) and see if this resolve the issue.
Many thanks for your reply.
Regards,
Guy
--
DizzyPenguin * autoMAC-it
email : <email@hidden>
website : <http://www.dizzypenguin.com/automac-it/>
_______________________________________________
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