Re: can't get the folder of info for x -- solved
Re: can't get the folder of info for x -- solved
- Subject: Re: can't get the folder of info for x -- solved
- From: JollyRoger <email@hidden>
- Date: Mon, 17 Sep 2001 15:50:30 -0500
On 9/17/2001 2:49 PM, "Brian Gollands" <email@hidden> wrote:
>
My thanks to all who wrote with suggestions to my problem (Jolly
>
Roger, Cornwall, AppleScripter). The 2 main answers were to test for
>
the last character in the path being a ":" to indicate a folder, or
>
to watch out for having inappropriate code in a Finder tell block.
>
Turns out that the latter is exactly what was happening -- the Finder
>
was using its folder class rather than the one I needed. As an
>
beginning scripter, I've learned a valuable lesson to not go hog wild
>
with tell blocks! Thanks to the above for getting back to me so
>
quickly and breaking the mental logjam.
You're welcome.
Note that it is still perfectly valid (and actually much faster!) to check
the last character to see if it is a colon. In case nobody has explained
how to do it:
repeat with this_file in file_list
set filePath to (path3 & this_file as string)
if (the last character of filePath = ":") then
-- it's a folder
else
-- it's a file
end if
end repeat
There are a few reasons why this is faster. I guess the most important
reason is that the "info for" command takes more time to gather the
information about the item (such as the folder size, etc.). Also, in some
versions of Mac OS (some versions of AppleScript) have a nasty bug that
causes "info for" to malfunction and generate an error when you use it on a
folder that contains more than 2 gigabytes of data.
HTH
JR