• 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: Finder - getting file type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Finder - getting file type
      • From: DizzyPenguin <email@hidden>
References: 
 >Finder - getting file type (From: DizzyPenguin <email@hidden>)

  • Prev by Date: Finder - getting file type
  • Next by Date: Re: Finder - getting file type
  • Previous by thread: Finder - getting file type
  • Next by thread: Re: Finder - getting file type
  • Index(es):
    • Date
    • Thread