The following script will make folders in the frontmost finder window and then animate the window upon completion. The script works smoothly triggering it from Script Editor or QuicKeys. However, if I save it as a script application and trigger it from the Finder, the animation part is very sluggish. I’m running this on a Quad G5, should this be happening?
Any thoughts or solutions would be greatly appreciated!
CarbonQuark
tell application "Finder"
activate
try
select the front Finder window -- As Insertion Location
set FOLDER_BOUNDS to bounds of the front Finder window -- Grab Bounds For Animation
set TARGET_FOLDER to insertion location -- Get Path Insertion Location
try
tell window frontmost to set current view to list view -- Set View To List View
end try
set NEW_FOLDERS to {"FOLDER01", "FOLDER02", "FOLDER03", "FOLDER04", "FOLDER05", "FOLDER06", "FOLDER07"}
repeat with NEXT_FOLDER in NEW_FOLDERS
try
make new folder at TARGET_FOLDER with properties {name:NEXT_FOLDER} -- Folder Creation
set current view of container window of result to list view -- Set View To List View
end try
end repeat
try
set SIDEBAR_SIZE to 100 -- Colapse Side Bar Animation
if sidebar width of the front Finder window is greater than 0 then
repeat 10 times
set SIDEBAR_SIZE to SIDEBAR_SIZE - 10
set sidebar width of the front Finder window to SIDEBAR_SIZE
end repeat
end if
end try
set ANIMATION_STEPS to 10
try
repeat ANIMATION_STEPS times -- Grow Window Animation
set item 1 of FOLDER_BOUNDS to (item 1 of FOLDER_BOUNDS) - 1
set item 2 of FOLDER_BOUNDS to (item 2 of FOLDER_BOUNDS) - 1
set item 3 of FOLDER_BOUNDS to (item 3 of FOLDER_BOUNDS) + 2
set item 4 of FOLDER_BOUNDS to (item 4 of FOLDER_BOUNDS) + 2
set bounds of the front Finder window to FOLDER_BOUNDS
end repeat -- Comment This And The Next Line Out To Have The Window Vibrate
repeat ANIMATION_STEPS times -- Shrink Window Animation
set item 1 of FOLDER_BOUNDS to (item 1 of FOLDER_BOUNDS) + 1
set item 2 of FOLDER_BOUNDS to (item 2 of FOLDER_BOUNDS) + 1
set item 3 of FOLDER_BOUNDS to (item 3 of FOLDER_BOUNDS) - 2
set item 4 of FOLDER_BOUNDS to (item 4 of FOLDER_BOUNDS) - 2
set bounds of the front Finder window to FOLDER_BOUNDS
end repeat
end try
end try
end tell