# Update and save Smart object via batchPlay

**URL:** <https://forums.creativeclouddeveloper.com/t/update-and-save-smart-object-via-batchplay/4613>\
**Category:** UXP Plugin API\
**Tags:** batch-play\
**Created:** [May 2, 2022, 6:31pm UTC](https://forums.creativeclouddeveloper.com/t/update-and-save-smart-object-via-batchplay/4613 "2022-05-02T18:31:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gonya](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@gonya](https://forums.creativeclouddeveloper.com/u/gonya)\
**Post date:** [May 2, 2022, 6:31pm UTC](https://forums.creativeclouddeveloper.com/t/update-and-save-smart-object-via-batchplay/4613/1 "2022-05-02T18:31:10Z")

</div>

Hi there, this is my first rodeo with UXP so I’m sorry in advance if I’m doing something terribly wrong.

I’m converting a layer to smart object and then open it and make some modifications. What I’m unable to do is after those modifications is saving the .psb which is usually saved in a temp folder so the original document updates the smart object. This is a snippet of what I have so far:

```auto
const result = batchPlay([
        // DUPLICATE LAYER
        {
            _obj: "duplicate",
            _target: [{
                _ref: "layer",
                _enum: "ordinal",
                _value: "targetEnum"
            }],
            version: 5,
            ID: [
                25
            ],
            _options: {
                dialogOptions: "dontDisplay"
            }
        },

        // CONVERT TO SMART OBJECT
        {
            _obj: "newPlacedLayer",
        },

        // EDIT SMART OBJECT
        {
            _obj: "placedLayerEditContents",
            _options: {
                dialogOptions: "dontDisplay"
            }
        },

        // DO STUFF

        // SAVE TBD

        //CLOSE
        {
            _obj: "close",
            _options: {
                dialogOptions: "dontDisplay"
            }
        },

    ], {
        synchronousExecution: true,
        modalBehavior: "fail"
    });

```

I’ve been checking what’s going on when I save using Alchemist but none of the listened events when saving seem to work.

---

<div class="post-metadata">

**Author:** ![gonya](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@gonya](https://forums.creativeclouddeveloper.com/u/gonya)\
**Post date:** [May 3, 2022, 6:24am UTC](https://forums.creativeclouddeveloper.com/t/update-and-save-smart-object-via-batchplay/4613/2 "2022-05-03T06:24:57Z")

</div>

Okay, I found a way that seems to work, I used Occultist to check what happened when I saved a smart object via photoshop action and it was simply

```auto
{
    _obj: 'save'
},

```

That’s it, that’s all needed to make a simple save action to the temp directory
