Renaming a duplicated file problem

Hi everyone,

I’m having a problem that I hope someone can help me with.

I have an AppleScript that duplicates a Keynote file and then changes the name of the newly created file. The script works, but it has a problem. When it renames the newly created Keynote file, the file loses it’s Keynote characteristics. It loses it’s Keynote icon, and it’s kind (as shown in the Get Info box) has changed from a document to a “Package”. And I can’t open it with Keynote.

Here is the relevant code, it’s part of an Applet, on open…

tell application "Finder" 
--...
	duplicate this_item
	set name of 1st item of the front Finder window whose name contains "copy" to temp_date 
end tell

The file duplicates okay, and both the original file and the duplicated file have their Keynote icons. The script then works with the new file, the one that has ‘copy’ in its name, and renames it to tomorrow’s date. I have tomorrow’s date in a variable temp_date. (In the format “January 12, 2009”) The renaming works, but the file is changed to a package.

The script chooses the new file by looking for one that has ‘copy’ in its name. It’s the only file in the folder than has copy in its name.

Any help would be appreciated. Thanks.

Model: Intel iMac
AppleScript: 2.0.1
Browser: Safari 525.27.1
Operating System: Mac OS X (10.5)

If you add ‘.key’ to the name when renaming it works.

Cheers,

Craig

You’re right!

Thank you very much.