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

Re: file type question


  • Subject: Re: file type question
  • From: Walter Ian Kaye <email@hidden>
  • Date: Thu, 9 Oct 2003 12:30:24 -0700

At 02:15p -0400 10/09/2003, Deivy Petrescu didst inscribe upon an electronic papyrus:

On Thursday, Oct 9, 2003, at 07:55 US/Eastern, Jim Brandt wrote:

Running the following script on a file gives:

<snip>
tell application "Finder"
set source to "HD1:Text File"
my Info_File( source )
end tell

File: HD1:Text File

Name: Text File
Folder: HD1:
Kind: Tex-Edit Document
Creator: TBB6
Type: TEXT


However, I have several scripts that, under OS 9 used the following syntax:

set theList to (every item of folder source1 whose file type is "TEXT")

when run under OS X I get the following error:

get every item of folder "HD1:Misc:" whose file type = "TEXT"
--> Finder got an error: Can't get every item of folder "HD1:Misc:" whose file type = "TEXT".

How do I get this to work the way it did under OS 9?

BTW, using:

set theList to (every item of folder source1 whose kind is "Tex-Edit Document")

works, but not when I want to deal with all text documents in a folder, regardless of the program that created them.


Well, if you try to run
get every item of folder "HD1:Misc:" whose file type = "TEXT"
in a folder that contains only documents then you get what you are looking for.
If you stick one folder in there, then you get your error message.
The problem is "file type" is a property that only files have, but folders do not. So, when the finder gets a folder and tries to get its file type it errors.
Why it does not happens with kind?
Because everything has a kind property, files, folders or alias, so all items have "kind" therefore the Finder can go looking for this property in every element of the list (every file...).
The good question is, why did on work on 9.2 and it does not with X.
I think it is due to differences in the way Finder manipulates and understand commands.
But *I think*

Or he only had files in the folder there. ;)

So to make a long story short, change 'item' to 'file'.


-boo :)
_______________________________________________
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.

References: 
 >Re: file type question (From: Deivy Petrescu <email@hidden>)

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