Re: Need help with image events droplet to save multiple files as png
Re: Need help with image events droplet to save multiple files as png
- Subject: Re: Need help with image events droplet to save multiple files as png
- From: deivy petrescu <email@hidden>
- Date: Mon, 2 Jan 2006 23:07:08 -0500
On Jan 2, 2006, at 20:35, Michael Cytrynowicz wrote:
Hi, Happy New Year all!
Can someone help me with something that must be embarassingly
simple, but is giving me a hard time?
I am trying to write a droplet which saves multiple files as png
(in the same folder as the original images). I think I'm getting
stuck in passing the path information for where Image Events has to
save the new file...
Any help is surely appreciated...
Mike
==============
on open these_items
repeat with i from 1 to the count of these_items
set this_item to item i of these_items
set the item_info to info for this_item
set this_path to (item i of these_items) as string
set the new_path to (((characters 1 thru -4 of this_path) as
text) & "png")
process_item(this_item)
end repeat
end open
on process_item(this_item)
tell application "Image Events"
launch
set thisImage to open this_item
scale thisImage to size 300
save thisImage as PNG in file new_path with icon
close thisImage
end tell
==============
Oi Michael,
Feliz ano novo!
On top of what Kai and Mark suggested, I'd suggest you change the line
--> set the new_path to (((characters 1 thru -4 of this_path) as
text) & "png")
by
--> set the new_path to ((text 1 thru ((offset of "." in (reverse of
(characters 1 thru -1 of this_path)) as string) * -1) of this_path) &
"png")
The original line would fail, that is, it would create a file
mytiff.tpng if mytiff was originally a tiff file, i.e. if it was
mytiff.tiff
Deivy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden