UXP for Smart-Object PDF placement in Cloud-hosted PSDs

Hey, stuck with a project and would really appreciate some help. I’m new to UXP so be please be nice.

Background / Goal
I work with a PSD mockup of a trailer that is stored in Creative Cloud. Each trailer has five faces (left side, right side, front, back door left, back door right), and my artwork is created as a single 5-page PDF. Ideally, a one-click UXP plugin would:

  1. Prompt me to select a multi-page PDF

  2. For each of the five Smart-Object layers in the mockup, automatically:

    • Open its embedded document

    • Replace its contents with the corresponding PDF page

    • Scale to 100%

    • Save & close, writing back to the Cloud PSD

But I can’t get it to work.

What I’ve tried:

Full “Headless” UXP Automation

  • Idea: In a single background script, loop through each Smart-Object layer and run:

    1. “Edit Contents” (to open the Smart-Object)

    2. “Replace Contents” (swap in the right PDF page)

    3. “Transform” (scale to fit)

    4. “Save & Close” (write back to Cloud PSD)

  • Problem: UXP’s executeAsModal mode is deliberately UI-free. Photoshop blocks UI-driven commands like Edit/Replace/Transform when they’re called in a headless context.

PDF-to-PNG Session-Token Approach

  • Idea: Convert each PDF page to a temporary PNG (using UXP file APIs), then use replaceContents or placeEvent with a session token to bypass the need to open the PDF at all.

  • Problem: Cloud-hosted PSDs still reject those batchPlay replace calls in headless mode, or silently do nothing. The SmartObject DOM methods (e.g. layer.smartObject.replaceContents()) aren’t implemented for Cloud–placed layers.

Hybrid “Open SO, Then Headless” Flow

  • Idea: First, let Photoshop open each Smart-Object normally (so you see the window). Then immediately run a short headless modal to do the copy/paste/transform/close.

Problem: Photoshop still throws “Replace Contents not available” or disk errors when closing Cloud Smart-Objects in a background modal.

Question

  • Is it even possible to do SmartObject replacement on Cloud-stored PSDs purely in UXP?

I currently have a ExtendScript (.jsx) but it is not compatible with Creative Cloud.

Thanks in advance!

Try interactive mode: https://developer.adobe.com/photoshop/uxp/2022/ps_reference/media/executeasmodal/#interactive-mode