I've noticed (also in CS3) that as soon as your commands leave InD it slows way down, compared to running out of InD. obviously, the biggest slow down is if the script takes InD out of the foreground, causing a panel redraw when you come back. that's unovoidable as far as I'm aware.
the best work-around I've found is to run your script from OS X's script menu and/or a third party quick key app. of course, I usually just live with the slow-down in practice.
When possible try to keep the Finder out of doing a lot of refreshing of file lists or getting file data. I've seen a 10x speed reduction from using 10.4 to 10.5 on getting lists or any file/folder lists from the Finder.
But my suggestion is, can you remove the "displayed name of" part from the command? I've not seen that (part of Smile?) but if it's making the Finder re-get the name of the folder, then it's probably the culprit. Current folder item is an alias at this point right.. maybe just coerce it to string instead of displayed name.
This is just a guess.
What version of the OS are you running?
In Finder you have the option to use 'entire contents' this will trawl all the sub-level items from your chosen folder location. This can be pretty slow dependent on how much it has to go through. You also have the ability to filter in AppleScript with the word 'whose' Something like this:
set This_Folder to (choose folder with prompt "Select your top level folder…" without invisibles)
tell application "Finder"
set My_Folder to every folder of entire contents of This_Folder whose displayed name = "RG_2472"
No OSXA required.
Better still is the option to call a shell and use spotlight to find your files/folders this is lightning fast and no finder required.
The above AppleScript can still take a few seconds if I select my desktop (which is loaded with junk) using a shell for the same is almost instant
Thanks for the suggestion SuperMacGuy... Just tried it... Converted the list of aliases into a list of strings before going into the loop... Still lags up when the "Find Text" command has to go over each entry in the list... So its does not seem to be the Finder... I'm guessing that it is the use of the Regexp plugin that is having trouble with InDesign.
Currently I am doing your first initial suggestion... running the script from the Script Menu supplied by Apple. That works...
> I'm guessing that it is the use of the Regexp plugin that is having trouble with InDesign.
Sort of. It's probably because you're telling InDesign to tell another app to use a scripting addition -- move the calls to Satimage out of the Finder block.
I am using 10.5.8
Unfrotunatly there are 2 problems with your solutions in my senario... The pattern "RG_2472" is not the exact name of the folder... it is found at the beggining of the folder name (eg. RG_2472_My_Folder_Project).
The second option using spotlight is an issue... The file is found on an external server where spotlight does not seem to be able to index correctly... this is a whole other issue that we have not been able to fix yet.
thanks for your suggestions
Thanks for that Shane... That fixed it!
AppleScript's 'whose' filtering can also deal with contains, starts with, ends with as well as = (is equal to), ≥ (greater than or equal to) and so on…
AppleScript's 'whose' filtering can also deal with contains
that's what came to mind for me also. you could isolate the items with 'contains'. are you trying to rename the folder, or just assign it to a variable?