# Copy as javascript 2025 - 2026

**URL:** <https://forums.creativeclouddeveloper.com/t/copy-as-javascript-2025-2026/11693>\
**Category:** Photoshop\
**Created:** [February 2, 2026, 12:52pm UTC](https://forums.creativeclouddeveloper.com/t/copy-as-javascript-2025-2026/11693 "2026-02-02T12:52:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![haller](https://avatars.discourse-cdn.com/v4/letter/h/53a042/32.png) [@haller](https://forums.creativeclouddeveloper.com/u/haller)\
**Post date:** [February 2, 2026, 12:52pm UTC](https://forums.creativeclouddeveloper.com/t/copy-as-javascript-2025-2026/11693/1 "2026-02-02T12:52:58Z")

</div>

I noticed some differences when using the Copy as JavaScript tool. Why did this change?

If I run it on Photoshop 2025, I get this result.

async function dupLayer() {  
let result;  
let psAction = require(“photoshop”).action;  
let command = [

{“\_obj”:“copyToLayer”}  
];  
result = await psAction.batchPlay(command, {});  
}

If I run it on Photoshop 2026, I get this result.

async function dupLayer() {  
let commands = [  
{  
“\_obj”: “copyToLayer”  
}  
];  
return await require(“photoshop”).action.batchPlay(commands, {});  
}

---

<div class="post-metadata">

**Author:** ![samgannaway](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@samgannaway](https://forums.creativeclouddeveloper.com/u/samgannaway)\
**Post date:** [February 2, 2026, 5:38pm UTC](https://forums.creativeclouddeveloper.com/t/copy-as-javascript-2025-2026/11693/2 "2026-02-02T17:38:52Z")

</div>

I believe you are seeing a change I made in August 2024 to pretty print the Action Descriptors instead of leaving them on one line.

It does look a bit strange with your example since it is one of the smallest. On the other end of the spectrum, text layer descriptors are halfway readable now.

Sam

---

<div class="post-metadata">

**Author:** ![haller](https://avatars.discourse-cdn.com/v4/letter/h/53a042/32.png) [@haller](https://forums.creativeclouddeveloper.com/u/haller)\
**Post date:** [February 2, 2026, 5:43pm UTC](https://forums.creativeclouddeveloper.com/t/copy-as-javascript-2025-2026/11693/3 "2026-02-02T17:43:52Z")

</div>

What I posted is a simple example.  
But I don’t understand the change.  
If I upload the entire file with console.log, it doesn’t work.  
Should I delete it?

```auto
 async function test() {
    let commands = [
        // Crea livello
        {
            "_obj": "make",
            "_target": [
                {
                    "_ref": "layer"
                }
            ],
            "layerID": 81
        },
        // Unisci visibili
        {
            "_obj": "mergeVisible",
            "duplicate": true
        }
    ];
    return await require("photoshop").action.batchPlay(commands, {});
}

console.log(
    await require("photoshop").core.executeAsModal(test, {"commandName": "Action Commands"})
);

```

if I leave this console log it doesn’t work

```auto
console.log(
    await require("photoshop").core.executeAsModal(test, {"commandName": "Action Commands"})
);

```
