Re: How to test if a dropped item (on open) is a file or folder
Re: How to test if a dropped item (on open) is a file or folder
- Subject: Re: How to test if a dropped item (on open) is a file or folder
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 03 Jul 2002 12:56:52 -0700
On 7/3/02 12:26 PM, I wrote:
>
Unfortunately neither your 'colon' method nor my 'info for' method works
>
in OS X, where the file system knows that cocoa apps - packages - are
>
really folders. (Thank goodness - it makes it possible to look inside if
>
needed.) But for simple things, where you want to consider cocoa apps to
>
be "files" rather than folders that need to be opened, the Finder will do
>
it:
Actually recent versions of 'info for' will tell you if it is a 'package
folder':
set itemInfo to info for theItem
if folder of itemInfo and not package folder of itemInfo then
--do folder stuff
else
--do file stuff
end if
But that will error older versions of OS 8/9. Better would be to put it into
a try block if designed for all OS's:
set itemInfo to info for theItem
if folder of itemInfo then
try
if not package folder of itemInfo then
--do folder stuff
else
--do file stuff
end if
on error
--do folder stuff
end try
else
--do file stuff
end if
--
Paul Berkowitz
_______________________________________________
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.