Re: file type question
Re: file type question
- Subject: Re: file type question
- From: Deivy Petrescu <email@hidden>
- Date: Thu, 9 Oct 2003 14:15:20 -0400
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*
Regards
Deivy Petrescu
http://www.dicas.com/
_______________________________________________
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.