I think they moved applescript to a different folder.
The applescript editor used to be here:
/Applications/AppleScript/Script\ Editor.app/
I think they moved it to /Applications/Utilities.
This line does the rename.
inside a tell finder.
set name of file actualName to newName
For debugging use the log statement.
(*
excel file where the first column is the new SKU name and the second column is the name of the photo that needs to be changed.
use excel to save as csv file -- comma separated
example file:
rename.csv
a,1
b,2
c,3
*)
on run
-- Write a message into the event log.
-- To see,
-- Run this applescript in Sript Editor.
-- Click on Event Log tab at bottom of screen.
-- Click run.
log " --- Starting on " & ((current date) as string) & " --- "
-- Ask user for the name of the file
set fileAlias to choose file with prompt "Pick the file with your list of files to rename."
log fileAlias
set aFile to fileAlias as text
log "aFile = " & aFile
-- Ask user for the name of the folder
set folderAlias to choose folder with prompt "Pick the folder that contains your list of files to rename."
log folderAlias
set aFolder to folderAlias as text
-- Based on Camelot's script in
-- http://discussions.apple.com/thread.jspa?threadID=2739645&tstart=0
set files2Rename to (paragraphs of (read file aFile))
log files2Rename
repeat with eachFile in files2Rename
log "eachFile = " & eachFile
set splitData to textToList(eachFile, ",")
set newName to item 1 of splitData
set oldName to item 2 of splitData
log "newName = " & newName & " oldName = " & oldName
tell application "Finder"
set actualName to aFolder & oldName
log "actualName = " & actualName
try
-- example rename command
-- set name of file "path:to:file" to (month of (current date)) & " " &
-- day of (current date) & ", " & year of (current date) as string
set name of file actualName to newName
on error msg
log "!!! could not rename newName = " & newName & " oldName = " & oldName
log "!!! error was " & msg
end try
end tell
end repeat
end run
-- textToList was found here:
-- http://macscripter.net/viewtopic.php?id=15423
on textToList(thisText, delim)
set resultList to {}
set {tid, my text item delimiters} to {my text item delimiters, delim}
try
set resultList to every text item of thisText
set my text item delimiters to tid
on error
set my text item delimiters to tid
end try
return resultList
end textToList
AppleScript
Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X, Third Edition the book
AppleScript Language Guide pdf download the pdf file
Intro to applescript with sending an email
http://mac.appstorm.net/how-to/applescript/the-ultimate-beginners-guide-to-apple script/