I’m attempting to change the Panther default folder action “Dupllicate to TIFF” to “Duplicate to TARGA”. We use TARGA files all day everyday and this would be extremely useul if I can get it work.
I’m new to Applescript by the way…
I went through the script and changed the instances where “tif” was, and changed it to “tga”.
ex; property done_foldername : “TARGA Images”
property originals_foldername : “Original Images”
property newimage_extension : “tga”
I also changed this at the bottom of the script where the actual “save as” portion is ex;
tell application “Image Events”
launch – always use with Folder Actions
set this_image to open file (source_file as string)
save this_image as TARGA in file target_path with icon
close this_image
after all that, here is the error I am getting " The variable TARGA is not defined"
I looked in the Image Events dictionary and found Targa listed as a file ending/format that it understands.
Any help would be appreciated. Like I said I’m new to Applescripting, but very excited about it. Thanks
No where in the Image Events dictionary is the word TARGA found (at least in my Image Events on Mac OS X 10.3.2) but TGA is so, use TGA, not TARGA:
tell application "Image Events"
launch -- always use with Folder Actions
set this_image to open file (source_file as string)
save this_image as TGA in file target_path with icon
close this_image
end tell
Now I’m having another issue, I tried like crazy to figure it out on my own but I’m stuck!
In order to keep the Alpha channel/ key signal the file has to saved as a 32 bit file.
As the script works now, Image Events must default to 24, because the Alpha dissapears.
I’ve tried “bit depth 32” witch is in the Image Events dictionary. No luck.
I tried several variations with out any luck.
I placed all these attempts after “with icon”. I tried once after “as TGA” but that didn’t work.
Any ideas?
tell application "Image Events"
launch -- always use with Folder Actions
set this_image to open file (source_file as string)
save this_image as TGA in file target_path with icon
close this_image
end tell
Are you really looking at the Image Events dictionary? In the dictionary, “bit depth” is a property of the “image”:
Class image: An image contained in a file
Plural form:
images
Elements:
metadata tag by name, by numeric index, before/after another element, as a range of elements, satisfying a test
Properties:
<Inheritance> item [r/o] -- All of the properties of the superclass.
color space Eight channel/Eight color/Five channel/Five color/Seven channel/RGB/Lab/XYZ/Six channel/CMYK/Six color/Seven color/Named/Gray [r/o] -- color space of the image's color representation
resolution list [r/o] -- the pixel density of the image, in dots per inch, as a pair of integers
bit depth sixteen colors/color/four grays/black & white/thousands of colors/grayscale/two hundred fifty six grays/four colors/sixteen grays/millions of colors/best/two hundred fifty six colors/millions of colors plus [r/o] -- bit depth of the image's color representation
name Unicode text [r/o] -- the name of the image
dimensions list [r/o] -- the width and height of the image, respectively, in pixels, as a pair of integers
image file file [r/o] -- the file that contains the image
file type PICT/Photoshop/BMP/QuickTime Image/GIF/JPEG/MacPaint/JPEG2/SGI/PSD/TGA/Text/PDF/PNG/TIFF [r/o] -- file type of the image's file
location disk item [r/o] -- the file location of the image
First, note that the bit depth is written out so the greatest depth is “millions of colors plus” and “32” will not work. Second, note the “[r/o]” notation for this property. That means it is “read-only” and can not be altered using Image Events. You’re better off using Photoshop or GraphicConverter.