Re: Problem Emptying Trash -- Update
Re: Problem Emptying Trash -- Update
- Subject: Re: Problem Emptying Trash -- Update
- From: Jon Rosen <email@hidden>
- Date: Wed, 8 Mar 2006 21:05:17 -0500
I want to thank everyone for their suggestions. I've decided that
there is a synchronization issue, but I'm not positive that it is
entirely AppleScript's fault. In the portion of the script that
deletes the file (delete thisFile as alias), it was giving me an
error message. I replaced the original portion of the script with the
following:
tell application "Finder"
delete pdfFolder's files
delay 1.5
update pdfFolder
empty
end tell
I'm not sure whether or not the delay is necessary at this point.
I'll try it without next time I run the script. Just before this part
of the script, I call a subroutine that combines the files into a
single PDF with a shell script call. I suppose it is possible that
the shell script hasn't finished cleaning up before moving on to
delete the files, However, I'm a little skeptical that that's the case.
This issue may have resolved another issue. Previously, the script
ran perfectly -- but it froze up after processing about 1,000
invoices. I never could find a reason for it, but assumed there was
some kind of memory leak within AppleScript. After I changed the
script to the version above, it processed about 1,600 invoices
(that's all there were at that time) more quickly and without
freezing. I did notice one other section of code that was processing
in a loop that only needed to be run once, at the beginning of the
script.
I'm going to test some different variations on deleting the files
that were suggested on and offline, but so far, so good.
Jon
On Mar 4, 2006, at 6:46 PM, Jon Rosen wrote:
We updated a computer from 10.3 to 10.4.5 and a script that had
been running reliably for well over a year started timing out. It
seems to hang up in a portion of the script that moves files in a
folder one at a time to the trash and then empties the trash. That
is this part of the script:
tell application "Finder"
repeat with i from 1 to pdfCount
--pdfFiles only contains a list of the individual PDF files
set thisFile to (pdfFolder as text) & item i of pdfFiles as text
delete thisFile as alias
end repeat
-- empty the trash so it doesn't fill up with 50,000 files
empty
end tell
I couldn't find a way to delete all of the files in a folder at
once, but I would welcome any suggestions. Has anything changed
between 10.3 and 10.4 that would affect this type of script. BTW, I
opened the Trash window in the Finder and added a 1 second delay
before the empty command, and that may have improved the situation
for unknown reasons. For the record, this script works with
FileMaker. It takes a group of PDF files created by FileMaker,
combines them using the PDFtk tookit, and then deletes the
individual files and moves the combined file to a new location.
TIA,
Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40jonro.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden