Re: Finder can't find
Re: Finder can't find
- Subject: Re: Finder can't find
- From: John Delacour <email@hidden>
- Date: Tue, 15 Apr 2003 13:39:57 +0100
- Mac-eudora-version: 6.0a15
At 8:08 am +0100 15/4/03, Sovereign Diamonds wrote:
I have a folder full of jpegs that I wish to rename using a file that
contains separate lines "OldName <tab> NewName", but Finder produces an
error saying that it can't find "OldName" using this script:
I rewrote the script and tried it with files containing UNIX line
endings and Mac line endings.
I think you need to look at the name and extensions of the files
concerned using the info window or, better, turn on "Always show file
extensions" in Finder preferences, and then read the event log in SE
to find out what's going on. You need also to use 'try' to skip
trailing line endings and blank lines.
set dir_ to choose folder with prompt "
Select the folder where the images are stored"
set filelist_ to choose file with prompt "
Select the file for the conversion"
set lines_ to paragraphs of (read filelist_)
set my text item delimiters to tab
repeat with line_ in lines_
set oldname_ to first text item of line_
set newname_ to last text item of line_
tell application "Finder"
try
set oldfile_ to "" & dir_ & oldname_
set name of file oldfile_ to newname_
end try
end tell
end repeat
set my text item delimiters to ""
set FolderOfImages to choose folder with prompt "Select the folder where the
images are stored"
set FileWithNames to choose file with prompt "Select the file for the
conversion"
set FileContent to paragraphs of (read (FileWithNames))
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to tab
repeat with x in FileContent
set OldName to first item of text items of x
set NewName to last item of text items of x
tell application "Finder" to set name of (((FolderOfImages as string) &
OldName) as alias) to NewName
end repeat
set AppleScript's text item delimiters to oldDelims
Any help would be appreciated?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.