var myDoc = app.activeDocument;
var myChannel = myDoc.channels.duplicate();// makes the duped channel the only active channel
myChannel.name = "Median"
myDoc.activeLayer.applyMedianNoise (5);// because the duped channel is the only one active the filter is applied only to it.
// you may want to restore the activeChannels to the component channels i.e for RGB
myDoc.activeChannels = [myDoc.channels,myDoc.channels,myDoc.channels];// make the RGB channel active
Not sure how that ports to AS, but the key is applyMedianNoise is a layer method. You can work with seperate channels if needed by making them active before calling the filter.
you're right, I took that code excerpt from a script that actually contained the activeLayer that you mention.
I still have to understand how to port properly in AS - which is a picky language.
Documentation for JS is extended, I hope Adobe will integrate AS in the Scripting Guide soon - since I'm far from being the best coder in town, I'm having some hard times ;-)
Thanks for your answer anyway,
I hope Adobe will integrate AS in the Scripting Guide soon Say what? »Photoshop CS5 Scripting Guide.pdf« does contain AS-examples and »Photoshop CS5 AppleScript Ref.pdf« doesn’t seem to shabby either.
Sorry, I understood AS to mean AppleScript, when you are talking about ActionScript – my mistake.
Sorry for the misunderstanding!!
AS in my intention should mean ActionScript for use with the new CS SDK, not AppleScript...
My bad, I had read your original post inattentively.
1 person found this helpful
What I do when I bump into in a part of the DOM which does not translate well into strongly typed ActionScript, is ususally to just throw in the towel...
I create an ExtendScript function to do the work and imbed it. I then call the ExtendScript function using jsxInterface.doSomethingTheEasyWay().
this makes perfect sense
I don't think I will fall in love with AS3. Here is the workaround I've found:
var app:Application = Photoshop.app;
var myDoc:Document = app.activeDocument;
var myChannel:Channel = myDoc.channels.index(0).duplicate();
myChannel.name = "Median";
var myChannelBis:ArtLayer = myDoc.activeLayer as ArtLayer;
that is, a new variable will contain the channel (as activeLayer) as ArtLayer.
Davide as AS newbie