I am developing a control dialog, using Satimage’s Smile dialog functionality. The task is pretty simple: having the user select a folder whose contents then will be copied to the in-folder of a workflow. To accomplish that, I use the following code:
set myPath to "/tests/sampling_folder/"
set targetFolder to POSIX file myPath as alias
tell application "Finder" to copy files of folder (choose folder with prompt "Zu übertragendes Verzeichnis wählen") to folder targetFolder
When I run it on my system (MacBook Pro (2008), OSX 10.6.8) with no mounted network drives or external disks, the folder picking dialog opens quite quickly. When my client tries it on his machine (iMac, OSX 10.8) with one or two network drives mounted, it may take a rather long time (up to about a minute or so) until the dialog shows up.
Are there any known issues with this environment which can explain the effect? Or am I doing something not quite right (being still a noob with Applescript)?
I had a similar issue. I switched from making Finder calls to doing shell scripts (see below). Problem solved.
on getMagDirs(gMag)
set magDirs to {} as list
set volList to (do shell script "ls /Volumes")
set diskList to {}
repeat with thisParagraph in every paragraph of volList
set end of diskList to thisParagraph
end repeat
repeat with i in diskList -- possibly report reduced performance when "format:AppleShare format" is detected.
set targetFolder to ((i as text) & ":" & (gMag as text))
if getFolder(targetFolder) is true then set magDirs to magDirs & (targetFolder as alias)
set targetFolder to ((i as text) & ":" & (gMag as text) & " Archive")
if getFolder(targetFolder) is true then set magDirs to magDirs & (targetFolder as alias)
end repeat
return magDirs
end getMagDirs