Applescript Help req. as script not working under 10.6.2

Joined
Mar 14, 2010
Messages
1
Reaction score
0
Points
1
Apologies if this is posted in the wrong place. I'm hoping someone can assist me with the following script which was kindly written for me a while ago. It worked for ages but now produces an error message. Does it need tweaking or rewriting?

I use the script to automatically sort files into folders which are created from a selected number of letters from the filenames. AT the moment I'm getting the message...

"error "Finder got an error: Can’t make \"500 Gb HUB 1:Downloads:JD: Thumbs Created - CHECK: FACES:Manuelas-2:\" into type item." number -1700 from "500 Gb HUB 1:Downloads:JD: Thumbs Created - CHECK: FACES:Manuelas-2:" to item"

Any help is much appreciated. Thanks.


--script---

set baseFolder to choose folder
set {ATID, AppleScript's text item delimiters} to {"", "-"}
tell application "Finder"
set theFiles to every file of entire contents of baseFolder as alias list

set s_c to text returned of (display dialog "Please enter the STARTING character:" default answer "")
set e_c to text returned of (display dialog "Please enter the ENDING character:" default answer "")
repeat with aFile in theFiles
set fileName to name of aFile
set collection to text s_c through e_c of fileName
set cont to container of aFile as string

if folder (cont & collection) exists then
else
make new folder at cont with properties {name:collection}
end if
-- The next line trims the file name as so given a file name "GroupAbcSubGroupDefViewXYZFile012345-0"
-- and entering Start: 9 End: 19 then when the file is moved the new name would be "SubGroupDefViewXYZFile012345-0"
-- To retain the text prior to the character start (assuming there is any) remove the following line.
-- set name of aFile to (text s_c through -1 of fileName)
move file aFile to (cont & collection & ":")
end repeat
end tell
set AppleScript's text item delimiters to ATID
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top