I first commented on this on Sep 7, 2010. Here is a new twist on the problem. (OS 10.6.6)
The original problem. ------------ I have an AppleScripted application bundle named "Write_Appls_Report". The script (about 90% removed) looks like this ...
on main() -- opens a file to which the report is written -- writes install history to the file -- gets an alias list of applications in the applications folder (path to applications folder) as alias -- set appFolder to path to applications folder set applPosixList to my getApplsList(the result)
-- less than 1 second elapsed to get here
set itemNamesList to {} repeat with i from 1 to (count items of applPosixList) set applPosixPath to (item i of applPosixList) set itemNamesList to my formatAndWrite(applPosixPath, itemNamesList, leaders, fileRefNr) end repeat -- on first run this takes over 40 seconds
-- close the file end main -------------------------------------
The problem is that on first run the elapsed time is always over 40 seconds, but if this script is immediately run again, the total elapsed time is only 4 to 6 seconds. The problem is in the repeat ... end repeat loop, but why?
Here is the new twist on the problem. ------------ I have another AppleScripted application bundle called "Annotate Preferences". It also gets a list of applications from various locations, then annotates the comment of the associated preference file in the Preferences folder with the name of the application creating the file.
If I restart, then run "Annotate Preferences", then run "Write_Appls_Report", the elapsed time for "Write_Appls_Report" is only 4 to 6 seconds. ("Annotate Preferences" does not seem to run slowly on first run.)
This seems to indicate that the problem is not in the script, but has something to do with the system or Finder. But, I haven't a clue what this would be. Anyone?
|