I too am struggling with the migration from OS 9 to X. The first two lines of the first script I’ve tried to run are broken, and I bet a lot of the rest of them are, too. I would like to be able to run this while in Column View. The View seems to make no difference, but please advise me how to fix this for OS X, and whether different views require different syntax. Thanks for any help you can give!
In plain english, I will have a folder full of files with very similar names: pic001.jpg, pic002.jpg, DSCN001.jpg, DSCN002.jpg, etc. You know what I mean, right? I’d like to “select,” or highlight, one of them; use the dialog box to truncate its name; have AS create a folder named with the remaining text and gather all the files in the “series” into the new folder. Used to work fine, now it’s broke! (There’s no way to know ahead of time exactly what naming conventions will be used. Hence, I’ve found I can’t use a set amount of truncation; I pretty much always have to do it by hand.)
I’m not sure I’ll be using the “set position” and size part of this script. That’s a legacy from attempting to emulate the OS X Column View in OS 9. (I always liked the NexT screen shots, and have wanted Column Views for a LONG time!) But, the rest of this thing would still be very handy! Thanks immensely for any help and other tips.
tell application “Finder”
activate
set theTargetFolder to container of selection
set theFileName to name of selection as string
if last word of theFileName contains “jpg” then
set theFileName to (characters 1 thru ((length of theFileName) - 4)) of theFileName as text
end if
display dialog “Delete the characters you don’t want to use:” default answer theFileName
set theNewFolderNameTemp to the text returned of result
set theFiles to every file of theTargetFolder whose name contains theNewFolderNameTemp
set theNewFolderName to theNewFolderNameTemp & “.”
set theNewFolder to make new folder at theTargetFolder ¬
with properties {name:theNewFolderName}
open theNewFolder
set position of front window to {575, 65}
set size of front window to {252, 539}
set current view of front window to (name)
set «class cuss» of front window to false
close theNewFolder
move theFiles to theNewFolder
end tell