RE: FInder not counting files right
RE: FInder not counting files right
- Subject: RE: FInder not counting files right
- From: email@hidden
- Date: Fri, 26 Apr 2002 10:06:22 EDT
At 16:18 -0500 4/25/2002, Olivier Destrebecq wrote:
>
I'm creating an application that write files to a temporary directory.
>
I wanted to write a script that would monitor that folder and tell me if
>
there were any file in there that were not used by my app anymore but
>
that was not deleted. So i created a stay open script that every 4
>
seconds looks at the folder and compare the number of file to the number
>
of document in my app. the problem is that the finder return me an
>
invalid count. it seems to update its count only when the user actually
>
open the folder to see it.
There is a lag between the time the write command is sent to create a file
and the time the finder updates it's file list. This delay is based on a
variety of factors, including machine speed and storage hardware type (SCSI
vs. E/IDE). You can see the delay yourself if you save a file in an app (such
as Quark XPress) onto the desktop and then immediately click onto the
finder's desktop -- the icon for the file won't show up for a number of
seconds. While it is conceivable that the Finder could be changed to make
this lag imperceptible, doing so would make the machine slow to a crawl as
progressively more processor cycles are used to do this process update cycle.
Personally, I've always thought that the Finder should have been made to
default to use the second processor in multi-processor macs on OS 8.6 and
higher (the OS's supported by various multiprocessor PowerPC-based macs).
Anyway, to correct your script, change the delay time, and/or cycle through
the finder as the foreground app.
i.e. -
-- shove this in just before the folder contents test.
Tell Application "Finder"
-- doing nothing might be adequet, without the delay
-- else include the following line
delay 10
end tell
Best Wishes,
Marc Glasgow
_______________________________________________
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.