• 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: 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

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

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