For startes I’d like to say hello to everyone! I’m new to applescripting, but am trying to learn. I made this script from some others so that whenever I drop a bunch of Gradients, Brushes, etc. onto the Photoshop Presets folder, it will auto sort the files without me having to go to each folder. The only problem is that I can’t get that dialog box to do what I want.
Currently, it will show a dialog after each one that says “Auto sorted a (whatever)” I would like it to display one dialog after it autosorts ALL of the items, and offers a summary; like "Autosorted 3 Brushes, 2 Gradients, etc. and has an OK button. Can anyone help me out? My goal is to then release this so everyone can use it; as I think it would be pretty useful.
Thanks to anyone that can help!
--This Folder Action should be attached to the Photoshop:Presets folder. Just drop the new files onto the Presets folder, and they will be auto sorted into their correct folders.--
property BrushesRecord : {extension:"abr", description:"Brushes", directory:"Brushes"}
property ColorSwatchesRecord : {extension:"aco", description:"Color Swatches", directory:"Color Swatches"}
property ContourRecord : {extension:"sch", description:"Contours", directory:"Contours"}
property ShapesRecord : {extension:"csh", description:"Custom Shapes", directory:"Custom Shapes"}
property GradientRecord : {extension:"grd", description:"Gradients", directory:"Gradients"}
property PatternRecord : {extension:"pat", description:"Patterns", directory:"Patterns"}
property ActionsRecord : {extension:"atn", description:"Actions", directory:"Photoshop Actions"}
property StyleRecord : {extension:"asl", description:"Styles", directory:"Styles"}
property validRecords : {BrushesRecord, ColorSwatchesRecord, ContourRecord, ShapesRecord, GradientRecord, PatternRecord, ActionsRecord, StyleRecord}
--The handler for responding to when items are added to a folder:
on adding folder items to TargetFolder after receiving DroppedItems
-- set targetFolderAlias to targetFolder as alias
repeat with currentFile in DroppedItems
tell application "Finder"
set targetFolderName to the name of TargetFolder
set droppedFileName to the name of currentFile
set droppedFileInfo to info for currentFile
end tell
repeat with currentRecord in validRecords
if extension of currentRecord is equal to the name extension of droppedFileInfo then
tell application "Finder"
set newTargetFolder to (folder named (directory of currentRecord) of TargetFolder)
if newTargetFolder exists then -- not sure about validity of this line...
move currentFile to newTargetFolder
display dialog " " & targetFolderName & " has auto-sorted a " & description of currentRecord & "." buttons {"OK"} default button 1 giving up after 2 --seconds
else
display dialog "the folder isn't there!" buttons {"OK"}
end if
end tell
end if
end repeat
end repeat
end adding folder items to