Copy link to clipboard
Copied
//I'm new to photoshop scripting with some basic Java knowledge. (i.e., Any and all assistance is //appreciated and I'm in my infancy—take it easy! 🙂
******
Overview:
I have Action 1 that creates a masked vibrancy layer dependent on a named channel existing. That named channel is created by Action 2. In lieu of regular errors cropping up, I would like to "test" for that channel's existence and run the appropriate Action(s).
Either: Run Action 1 because named channel exists
Or: Create named channel via Action 2, then run Action 1 because named channel now exists.
//Said another way, I want to avoid:
Some Final Thoughts/Questions:
Try the following... Change the channel name variable from "test" and the Action and Action Set names as required.
/*
Conditionally Run Actions If Channel Exists.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/if-named-channel-exists-run-action-1-else-create-named-channel-via-action-2-and-run-action-1/td-p/13256654
*/
try {
var chaName = "test";
activeDocument.channels[chaName];
//alert("The channel exists!");
// Run Action 1 f
...
Copy link to clipboard
Copied
Try the following... Change the channel name variable from "test" and the Action and Action Set names as required.
/*
Conditionally Run Actions If Channel Exists.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/if-named-channel-exists-run-action-1-else-create-named-channel-via-action-2-and-run-action-1/td-p/13256654
*/
try {
var chaName = "test";
activeDocument.channels[chaName];
//alert("The channel exists!");
// Run Action 1 from Set 1
app.doAction("Action 1", "Action Set 1");
// Select the channel by name
//var channelByName = new Array(app.activeDocument.channels[chaName]);
//activeDocument.activeChannels = channelByName;
} catch (e) {
//alert("The channel doesn't exist!");
// Run Action 2 from Set 2
app.doAction("Action 2", "Action Set 2");
// Run Action 1 from Set 1
app.doAction("Action 1", "Action Set 1");
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
@Dream Anchor Photography – So, how did the script work for you?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Great, you're welcome, I like to give back to the community where I am able.