Re: Finder can't find
Re: Finder can't find
- Subject: Re: Finder can't find
- From: david <email@hidden>
- Date: Tue, 15 Apr 2003 03:50:25 -0400
On Tuesday, April 15, 2003, at 03:08 AM, 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:
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?
neat script!
this script works okay for me. i created a text file with
oldName<tab>newName and first selected a folder with jpegs, then
selected the text file newName.
here is a copy of the event log:
tell current application
choose folder with prompt "Select the folder where the
images are stored"
alias "Macintosh HD:Users:david:Desktop:jpgs:"
choose file with prompt "Select the file for the
conversion"
alias "Macintosh HD:Users:david:Desktop:newName"
read alias "Macintosh HD:Users:david:Desktop:newName"
"KodakP1.jpg 1.jpg
KodakP2.jpg 2.jpg
KodakP3.jpg 3.jpg
KodakP4.jpg 4.jpg
KodakP5.jpg 5.jpg"
end tell
tell application "Finder"
set name of alias "Macintosh HD:Users:david:Desktop:jpgs:KodakP1.jpg"
to "1.jpg"
"1.jpg"
set name of alias "Macintosh HD:Users:david:Desktop:jpgs:KodakP2.jpg"
to "2.jpg"
"2.jpg"
set name of alias "Macintosh HD:Users:david:Desktop:jpgs:KodakP3.jpg"
to "3.jpg"
"3.jpg"
set name of alias "Macintosh HD:Users:david:Desktop:jpgs:KodakP4.jpg"
to "4.jpg"
"4.jpg"
set name of alias "Macintosh HD:Users:david:Desktop:jpgs:KodakP5.jpg"
to "5.jpg"
"5.jpg"
end tell
david in maine
_______________________________________________
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.