Re: Changing the name of a file in the temporary items folder
Re: Changing the name of a file in the temporary items folder
- Subject: Re: Changing the name of a file in the temporary items folder
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 06 Dec 2007 20:36:29 -0800
- Thread-topic: Changing the name of a file in the temporary items folder
Title: Re: Changing the name of a file in the temporary items folder
On 12/6/07 6:09 PM, "Michelle Steiner" <email@hidden> wrote:
When I run this script
set source to (choose file)
set destination to choose folder
tell application "Finder"
set temp to (duplicate source to path to temporary items from user domain)
set name of temp to "new name." & name extension of temp
name of temp
end tell
Why doesn't it change the name of the file?
Are you quite sure it doesn't? 'temp' is a Finder reference (file "oldname.ext" of of folder "TemporaryItems" of folder "Caches" of folder "Library" of folder "me" of folder "Users" of startup disk) , not an alias. So once you've renamed it, 'temp' - as a Finder reference - no longer exists. It should error, and does in OS 10.4.11
Try this:
set source to (choose file)
set destination to choose folder
tell application "Finder"
set temp to (duplicate source to path to temporary items from user domain) as alias
set name of temp to "new name." & name extension of temp
name of temp
end tell
--> "new name.doc"
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden