Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Script has slowed massively due to Snow Leopard

I am using AppleScript to retrieve jobs from our job server (afp mount). What used to take a couple seconds in Leopard now takes minutes (or times out completely)

Here is the portion of the code that has slowed to a crawl. (theYearFolder and theJobNumber is defined earlier in the script)

tell application "Finder"
with timeout of 777 seconds
try
*duplicate (every folder in theYearFolder whose name begins with thejobnumber) to the desktop*
on error the error_message
display dialog the error_message buttons {"Cancel"} default button 1 with icon caution
end try
end timeout
end tell

I am aware that there are some new changes in SL that cause certain operations to be duplicated if they are called inside a Finder tell block. As far as I can tell, that is not what is happening. Is there a known speed issue with the new Cocoa Finder + AppleScript? Or is there something I can change in my script that would speed up this operation?

PS …theYearFolder contains several hundred items.

Ideas?

24" iMac - Core 2 Duo 2.16, Mac OS X (10.6), 2GB RAM • GeForce 7600 GT

Posted on Sep 14, 2009 9:08 AM

Reply
Question marked as Best reply

Posted on Sep 14, 2009 2:39 PM

From Apple's Mailing Lists, the whose clause does appear to be significantly slower in Snow Leopard.
6 replies

Sep 14, 2009 3:45 PM in response to Q Lazarus

It doesn't NEED to be done in AppleScript, but I'm not good with any other language. I would be up for suggestions though! Especially if someone gave me a bash script that I could call via do shell script.

Otherwise, I might have to iterate each item in the folder looking for the specified job that way. Seems like that would be slow as well.

Sep 16, 2009 6:53 AM in response to zwei

Here's a basic script that should give you a start:

<pre style="margin:0px;padding:5px;border:2px dotted green;width:630px; height:auto;color:#ffffff;background-color:#000000;overflow-x:auto;overflow-y:h idden;font-family:Verdana, Monaco, monospace;font-weight:bold;font-size:12px;"
title="Copy this text and paste it into your Script Editor application.">set theYearFolder to choose folder
set theJobNumber to 2

do shell script "find " & ¬
quoted form of text 1 through -2 of POSIX path of theYearFolder & ¬
" -type d -name '" & theJobNumber & "*' -exec cp -R '{}' ~/Desktop \\;"</pre>

Of course you won't need the first couple lines of code, I just used those to write the script. Hope this helps...

Script has slowed massively due to Snow Leopard

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.