// Events recognized as notifiers are not re-playable in most of the cases. There is high chance that generated code won't work.
const {executeAsModal} = require("photoshop").core;
const {batchPlay} = require("photoshop").action;
async function actionCommands() {
const result = await batchPlay(
[
{
_obj: "duplicate",
_target: [
{
_ref: "layer",
_enum: "ordinal",
_value: "targetEnum"
}
],
name: "Halftone Results",
version: 5,
ID: [
175,
176,
177,
178
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "hide",
null: [
{
_ref: [
{
_ref: "layer",
_name: "Layer 0"
},
{
_ref: "layer",
_name: "KOB Artwork"
},
{
_ref: "layer",
_name: "Blacks"
},
{
_ref: "layer",
_name: "KO Black"
},
{
_ref: "layer",
_name: "KOB Artwork"
},
{
_ref: "layer",
_name: "Blacks"
}
]
}
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "newPlacedLayer",
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "placedLayerEditContents",
documentID: 60,
layerID: 179,
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "selectNoLayers",
_target: [
{
_ref: "layer",
_enum: "ordinal",
_value: "targetEnum"
}
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "show",
null: [
{
_ref: [
{
_ref: "layer",
_name: "KOB Artwork"
},
{
_ref: "layer",
_name: "Blacks"
}
]
}
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "make",
_target: [
{
_ref: "layerSection"
}
],
from: {
_ref: "layer",
_enum: "ordinal",
_value: "targetEnum"
},
layerSectionStart: 184,
layerSectionEnd: 185,
name: "Group 1",
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "set",
_target: [
{
_ref: "layer",
_enum: "ordinal",
_value: "targetEnum"
}
],
to: {
_obj: "layer",
name: "Artwork"
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "mergeLayersNew",
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "duplicate",
_target: [
{
_ref: "layer",
_enum: "ordinal",
_value: "targetEnum"
}
],
name: "Halftones",
version: 5,
ID: [
186
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "select",
_target: [
{
_ref: "layer",
_name: "Artwork"
}
],
makeVisible: false,
layerID: [
184
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "make",
new: {
_class: "channel"
},
at: {
_ref: "channel",
_enum: "channel",
_value: "mask"
},
using: {
_enum: "userMaskEnabled",
_value: "transparency"
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "delete",
_target: [
{
_ref: "channel",
_enum: "ordinal",
_value: "targetEnum"
}
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "select",
_target: [
{
_ref: "layer",
_name: "Halftones"
}
],
makeVisible: false,
layerID: [
186
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "newPlacedLayer",
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "placedLayerEditContents",
documentID: 433,
layerID: 187,
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "convertMode",
to: {
_class: "grayscaleMode"
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "convertMode",
to: {
_obj: "bitmapMode",
resolution: {
_unit: "densityUnit",
_value: 1440
},
method: {
_enum: "method",
_value: "halftoneScreen"
},
frequency: {
_unit: "densityUnit",
_value: 45
},
angle: {
_unit: "angleUnit",
_value: 22.5
},
shape: {
_enum: "shape",
_value: "ellipse"
}
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "imageSize",
resolution: {
_unit: "densityUnit",
_value: 300
},
scaleStyles: true,
constrainProportions: true,
interfaceIconFrameDimmed: {
_enum: "interpolationType",
_value: "nearestNeighbor"
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "save",
in: {
_path: "C:\Users\Johnny\AppData\Local\Temp\Halftones1.psb",
_kind: "local"
},
saveStage: {
_enum: "saveStageType",
_value: "saveBegin"
},
documentID: 445,
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "save",
in: {
_path: "C:\Users\Johnny\AppData\Local\Temp\Halftones1.psb",
_kind: "local"
},
documentID: 445,
saveStage: {
_enum: "saveStageType",
_value: "saveSucceeded"
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "close",
documentID: 445,
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "set",
_target: [
{
_ref: "channel",
_property: "selection"
}
],
to: {
_ref: "channel",
_enum: "channel",
_value: "blue"
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "inverse",
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "delete",
_target: [
{
_ref: "layer",
_enum: "ordinal",
_value: "targetEnum"
}
],
layerID: [
187
],
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "make",
new: {
_class: "channel"
},
at: {
_ref: "channel",
_enum: "channel",
_value: "mask"
},
using: {
_enum: "userMaskEnabled",
_value: "revealSelection"
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "save",
in: {
_path: "C:\Users\Johnny\AppData\Local\Temp\Halftone Results4.psb",
_kind: "local"
},
saveStage: {
_enum: "saveStageType",
_value: "saveBegin"
},
documentID: 433,
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "save",
in: {
_path: "C:\Users\Johnny\AppData\Local\Temp\Halftone Results4.psb",
_kind: "local"
},
documentID: 433,
saveStage: {
_enum: "saveStageType",
_value: "saveSucceeded"
},
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "close",
documentID: 433,
_options: {
dialogOptions: "dontDisplay"
}
},
{
_obj: "rasterizeLayer",
_target: [
{
_ref: "layer",
_enum: "ordinal",
_value: "targetEnum"
}
],
_options: {
dialogOptions: "dontDisplay"
}
}
],
{
modalBehavior: "execute"
}
);
}
async function runModalFunction() {
await executeAsModal(actionCommands, {"commandName": "Action Commands"});
}
await runModalFunction();