Deleting alpha channels from Photoshop...


I’m trying to make a simple script that will delete any alpha channels that may exist in the current document in Photoshop (I’ll incorporate it into a larger script after I figure it out.) The only thing I came up with so far is this:

tell application "Adobe Photoshop 7.0" 
delete {channels of current document whose name contains "alpha"} 
end tell 

This works fine, but it will not work with alpha channels that have been renamed. I have tried using the kind properties “masked area channel” and “selected area channel” (according the PS7ScriptingGuide.pdf) in various ways, but can’t get it to work.

The script I need is on the tips of my fingers, I know it ;o) Any help?

Mac OS 9.2.2
AS 1.8.3
Photoshop 7.0.1


Here’s a solution:

tell application "Adobe Photoshop 7.0"
set number_of_channels to count every channel of current document
repeat (number_of_channels - 3) times
set channel_to_delete to {the last channel of current document}
delete channel_to_delete
end repeat
end tell

This is for an RGB document. For a CMYK, change the ‘3’ to ‘4’.