Re: file type question
Re: file type question
- Subject: Re: file type question
- From: Andrew Oliver <email@hidden>
- Date: Thu, 09 Oct 2003 12:44:46 -0700
>
> 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.
Yes, and no.
Since you ask for 'every item', the Finder first gets every item in the
folder and then checks its 'file type' property.
The simple fix is to not ask for every ITEM, but just every FILE.
get every file of folder "HD1:Misc:" whose file type = "TEXT"
Works every time, even with subfolders in the specified folder.
Andrew
:)
On 10/9/03 11:15 AM, "Deivy Petrescu" <email@hidden> wrote:
>
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.
_______________________________________________
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.