Re: Duplicate command syntax
Re: Duplicate command syntax
- Subject: Re: Duplicate command syntax
- From: Rob Jorgensen <email@hidden>
- Date: Wed, 3 Jul 2002 23:07:16 -0400
On 7/3/02, email@hidden commented:
I've got the Applescript manual right in front of me, but I must be
missing something really obvious. Can anyone tell me what's wrong
with this script?
tell application "Finder"
duplicate "Macintosh HD:file1.htm" to "Macintosh HD:file2.htm"
end tell
If I run it, I just get a "can't set Macintosh HD: file1.htm to
Macintosh HD:file2.htm" error. I wish it would tell me why.
1. Those don't appear to be valid file references. They're just
strings as far as the Finder and AppleScript are concerned.
2. I believe you'll need to duplicate the file and then rename it.
This might work:
tell application "Finder"
set newFile to duplicate alias "Macintosh HD:file1.htm"
set name of newFile to "file2.htm"
end tell
This will place the duplicate in the same location as the original.
If you want to put it somewhere else, you'll need to tell the script
where to put it.
--
Rob Jorgensen
http://macscripter.net/ - Your best source for all things AppleScript
_______________________________________________
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.