(* Inspired on: Group in New Folder 1.01. 2003 Blue Danube Enterprises.*) tell application "Finder" set theList to the selection if the theList is {} then beep display dialog "No files or applications are selected."  buttons {"Cancel"} default button 1 end if end tell set listNames to {} repeat with listItem in theList set listNames to listNames & {basename(the name of listItem as string)} end repeat set listNames to sort(listNames) set defaultName to choose from list listNames with prompt  "Pick a name for your new folder:" default items item 1 of  listNames OK button name "OK" cancel button name  "Enter your own" without multiple selections allowed  and empty selection allowed if the result is false then set defaultName to "" end if tell application "Finder" set thename to (text returned of (display dialog  "Edit your folder's name:" default answer defaultName)) set theLocation to the target of Finder window 1 repeat if thename is in (the name of every item of theLocation) then set thename to (text returned of (display dialog  ("An item with the name Ò" & thename &  "Ó already exists." & return & "Please enter a new name:") default answer thename)) else exit repeat end if end repeat set newFolder to (make new folder with properties  {name:thename} at theLocation) try move theList to newFolder select newFolder activate end try end tell on basename(my_text) -- Save the default Applescript delimiter set savedTextItemDelimiters to AppleScript's text item delimiters -- Set the Applescript delimiter to "my_delim" set AppleScript's text item delimiters to {"."} set my_count to count text items of my_text if my_count > 1 then set my_text to text items 1 through (my_count - 1) of my_text end if set my_text to my_text as string -- Restore the default Applescript delimiter set AppleScript's text item delimiters to savedTextItemDelimiters return my_text end basename (* http://www.macosxhints.com/article.php?story=20040513173003941 Sort lists in AppleScript using the Unix sort command Mon, May 17 '04 at 09:13AM ¥ from: erickaterman *) on sort(the_list) set old_delims to AppleScript's text item delimiters set AppleScript's text item delimiters to {ASCII character 10}  -- always a linefeed set list_string to (the_list as string) set new_string to do shell script "echo " & quoted form of list_string  & " | sort -f" set new_list to (paragraphs of new_string) set AppleScript's text item delimiters to old_delims return new_list end sort