Re: Slow Command in Snow Leopard
Re: Slow Command in Snow Leopard
> I have a repeat loop which repeats 100s of times. It contains the line ...
>
> tell application "Finder"
> set itemsList to (files of prefsRef whose name starts with prefIdent) as alias list
>
> (prefsRef is an alias to the Preferences folder and prefIdent is a string)
> In Snow Leopard this one line is so slow that, while the script is running, the Finder lack responsiveness. Scroll bars don't work, mouse clicks don't work, ...... then they work.
>
> Anyone know what's going on in SL that would cause this?
Hmmm,
I tried this version of your script on my mac with Snow Leopard and each time repeat took about 6 seconds.
If you're repeating that 100 times, that would be 10 minutes, which does seem long, but not hours.
I think it would be faster to get a list of all the names of files, then repeat through the list looking for your strings outside the finder tell.
But, to answer what's causing this. It may be that after so many calls to the finder it slows down.
HTH,
ES
set prefsRef to path to preferences folder
set startStrings to {"Adobe Save For Web 9.0 Prefs", "Adobe", "A", "xxx"}
set AppleScript's text item delimiters to {tab}
set PrefResults to {{"String", "ItemsFound", "Time"} as text}
repeat with prefIdent in startStrings
set startTime to current date
tell application "Finder"
set itemsList to (every file of prefsRef whose name starts with prefIdent) as alias list
end tell
set elapsedTime to (current date) - startTime
set theseResults to {prefIdent as text, the (count of itemsList) as text, elapsedTime as text} as text
set the end of PrefResults to theseResults
end repeat
set AppleScript's text item delimiters to {return}
display dialog PrefResults as text
PrefResults as text
-- String ItemsFound Time
-- Adobe Save For Web 9.0 Prefs 1 10
-- Adobe 4 6
-- A 8 5
-- xxx 0 6
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden