Re: How to rename a file?
Re: How to rename a file?
- Subject: Re: How to rename a file?
- From: Graff <email@hidden>
- Date: Sat, 06 Dec 2003 17:06:35 -0500
First of all, I'm assuming that you have that code within a tell block
to the Finder, since "duplicate" and "displayed name" are Finder
commands and properties.
Secondly, displayed name is a read-only property so it can't be set.
I tried this code and it works fine, but doesn't set the extension:
-----------
tell application "Finder"
duplicate theFile
set theNewFile to the result
set the name of theNewFile to bundleName
end tell
-----------
To have the extension remain the same you need to do something similar
to this code:
-----------
tell application "Finder"
duplicate theFile
set theNewFile to the result
set theExtension to the name extension of theFile
set the name of theNewFile to bundleName & "." & theExtension
end tell
-----------
- Ken
On Dec 6, 2003, at 4:36 PM, Mark Dawson wrote:
How do you rename a file (in my case from a duplication)?
Here's is my code (10.2.8):
duplicate theFile
set theNewFile to the result
set the displayed name of theNewFile to bundleName
I tried both "displayed name" and "name"; I also put in a default name
("temp"); in all cases I get an error, "Can't set file name "x copy" of
folder "xx" to "temp"
Thanks,
Mark
email@hidden
_______________________________________________
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.
_______________________________________________
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.