I wrote a test script this evening that did nothing except test for
the -108 error.
For the record, here's the script ...
on open dropList
tell application "Finder"
repeat with droppedItem in dropList
if (class of item droppedItem) is folder then my scanFolder1(droppedItem)
end repeat
end tell
end open
------------------------------------------------------------------------
on scanFolder1(folderRef)
tell application "Finder"
open folderRef
try
set itemList to (items of folderRef) as list
on error number errNr
beep
if errNr = -108 then
"Folder not processed due to out of memory error."
else
"Folder not processed due to error " & errNr
end if
tell me to display dialog the result buttons {"OK"} default button 1
close folderRef
select folderRef
error number -128
end try
repeat with theItem in itemList
try
reveal theItem
end try
class of theItem
if the result is folder then my scanFolder1(theItem)
end repeat
try
reveal item 1 of itemList
end try
close folderRef
end tell
end scanFolder1
--------------------------------------------------------------------
I started with 200K assigned memory and soon found a folder that
exceeded this memory. (I was using the Developer:Documentation:
folder installed from the OS X Developer CD-ROM.) Increasing the
memory to 2MB gave improved results. Folders that previously errored
now worked. But there were still folders that were big enough to
error. Increasing the memory beyond 2MB did not seem to help.
Contrary to my earlier guess, the application's ass(pause to watch
South Park)igned memory is involved, but it's impossible to assign
enough memory to prevent Out Of Memory. Can anyone explain this?
I tried to avoid the Out Of Memory problem with the handler below.
The first time I tried it, I was impressed! Waaaaay fast and and no
errors! This was an illusion. It can reference only the odd numbered
files (in order by name): item 1 is the first file; item 2 the third
file; etc. When the loop reaches the end of the folder it starts with
file 1 again. It misses all the even files. In one folder, items 2, 4
and 5 all referred to the same file. This handler fails very badly!
It looks like I'm stuck with 'set itemList to ...'.
on scanFolder2(folderRef)
tell application "Finder"
open folderRef
repeat with i from 1 to (count items in folderRef)
set itemRef to item i of folderRef
try
reveal itemRef
end try
--comment of itemRef -- diagnostic
--set comment of itemRef to the result & ", " & i -- diagnostic
--set comment of itemRef to "" --use this to remove comments, later
class of itemRef
if the result is folder then my scanFolder2(itemRef)
end repeat
try
reveal item 1 of folderRef
end try
close folderRef
end tell
end scanFolder2
--------------------------------------------------------------------
------------------------------
This archive was generated by hypermail 2b29 : Sun May 27 2001 - 12:00:28 AEST