Re: How do I create and name duplicates in the same path as the originals?
Re: How do I create and name duplicates in the same path as the originals?
- Subject: Re: How do I create and name duplicates in the same path as the originals?
- From: Shane Stanley <email@hidden>
- Date: Wed, 09 Oct 2002 20:49:01 +1000
On 9/10/02 7:01 PM +1000, Steve Carlson, email@hidden, wrote:
>
Hi everyone - I'm a Perl guy trying to get my feet wet with AS,
>
and I'm having a hard time figuring out how to do something that I think
>
should be fairly simple. I have a droplet that takes a list of files
>
(JPGs) and should make a duplicate of each file, in the same directory as
>
the original. A simple bit of code:
>
>
on open myitems
>
repeat with i from 1 to number of items in myitems
>
set thisFile to item i of myitems as alias
>
tell application "Finder" to duplicate file thisFile
>
end repeat
>
end open
>
>
This much I can make work, but what I can't seem to figure out is
>
how to specify the new file's name, rather than use the "foo copy.jpg"
>
that the Finder picks by default. (I'd like it to be the value of (i &
>
".jpg")) I also want to have the duplicate reside in the same folder as
>
the original.
Try something like this:
on open myitems
repeat with i from 1 to number of items in myitems
tell application "Finder"
duplicate item i of myitems
set name of result to ((i as text) & ".jpg")
end tell
end repeat
end open
--
Shane Stanley, 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.