Copy link to clipboard
Copied
I want to use action. so, I want select all channels with the menu bar. so use in multiple files. I use the script for more than 100 files. all files have a different name in channels. i also attache sample of my channels.
Try this function:
selectAllChannels();
function selectAllChannels() {
var totCha = activeDocument.channels.length;
var actCha = new Array();
for (var i = (totCha - 1); i >= 0; i--) {
actCha.push(activeDocument.channels[i]);
}
activeDocument.activeChannels = actCha;
};
There may be a faster way with Action Manager code, however, I'm not the one to answer that!
P.S. Actions and scripts are different things. Once installed, the script can be recorded into an
...@ART CORNER – I was obviously assuming that you had 3 channels ready to convert directly into RGB, you never mentioned having 4 spot channels that you needed to convert into an approximate RGB visual equivalent.
Seems easy enough to record into an action or to script step by step via the ScriptingListener plugin as you already know what to do step by step...
#target photoshop
try {
if (activeDocument.mode == DocumentMode.MULTICHANNEL && activeDocument.channels.length == 4) {
acti
...
Copy link to clipboard
Copied
Try this function:
selectAllChannels();
function selectAllChannels() {
var totCha = activeDocument.channels.length;
var actCha = new Array();
for (var i = (totCha - 1); i >= 0; i--) {
actCha.push(activeDocument.channels[i]);
}
activeDocument.activeChannels = actCha;
};
There may be a faster way with Action Manager code, however, I'm not the one to answer that!
P.S. Actions and scripts are different things. Once installed, the script can be recorded into an action. A custom keyboard shortcut can also be applied to the installed script.
Copy link to clipboard
Copied
your code is working.
Thank you, sir.
I want to convert the multi-channel files into RGB.
please help me.
i have one more help needed please help me.
Copy link to clipboard
Copied
@ART CORNER wrote:
your code is working.
Thank you, sir.
I want to convert the multi-channel files into RGB.
please help me.
i have one more help needed please help me.
Try this:
#target photoshop
try {
if (activeDocument.mode == DocumentMode.MULTICHANNEL && activeDocument.channels.length == 3) {
activeDocument.changeMode(ChangeMode.RGB);
}
} catch (e) {}
Copy link to clipboard
Copied
really sorry,
but not working
Copy link to clipboard
Copied
Is the file in multichannel mode? Does the file have less or more than 3 channels?
The code previously posted checks for the file being in MC mode and only having 3 channels. You could try changing the check for 3 channels for greater than or equal to 3.
activeDocument.channels.length >= 3
Copy link to clipboard
Copied
Copy link to clipboard
Copied
@ART CORNER – I was obviously assuming that you had 3 channels ready to convert directly into RGB, you never mentioned having 4 spot channels that you needed to convert into an approximate RGB visual equivalent.
Seems easy enough to record into an action or to script step by step via the ScriptingListener plugin as you already know what to do step by step...
#target photoshop
try {
if (activeDocument.mode == DocumentMode.MULTICHANNEL && activeDocument.channels.length == 4) {
activeDocument.channels.add();
activeDocument.activeLayer.invert();
moveChannel(1);
activeDocument.changeMode(ChangeMode.GRAYSCALE);
activeDocument.changeMode(ChangeMode.RGB);
selectAllChannels();
var idmergeSpotChannel = stringIDToTypeID("mergeSpotChannel");
executeAction(idmergeSpotChannel, undefined, DialogModes.NO);
}
} catch (e) {}
// Functions
function moveChannel(chaInd) {
function s2t(s) {
return app.stringIDToTypeID(s);
}
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
var reference2 = new ActionReference();
reference.putEnumerated(s2t("channel"), s2t("ordinal"), s2t("targetEnum"));
descriptor.putReference(s2t("null"), reference);
reference2.putIndex(s2t("channel"), chaInd);
descriptor.putReference(s2t("to"), reference2);
executeAction(s2t("move"), descriptor, DialogModes.NO);
}
function selectAllChannels() {
var totCha = activeDocument.channels.length;
var actCha = [];
for (var i = (totCha - 1); i >= 0; i--) {
actCha.push(activeDocument.channels[i]);
}
activeDocument.activeChannels = actCha;
}