• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Adding Undo to a UXP Script

Community Expert ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

Hi gang,

In a wonderful post here:

https://creativepro.com/add-undo-to-your-script/

... by the venerable Theunis De Jong, it was described how to add a few lines of code to a jsx script to cause it to undo in 1 undo step.

 

How is this done in UXPScripts?

Mike Witherell
TOPICS
Scripting

Views

944

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

Hi there,

 

Just tested app.doScript in UXP Scripting and I think it's partially implemented, to say the least:

  • calling a function fails whether you call it by its reference (app.doScript(main…)) or by a string (app.doScript("main()"…)
  • Passing the code as a string works ("app.doScript("app.activeDocument.textFrames.add(…) BUT the cancel instruction produces no effet (app.doScript("code", [arguments], [UndoModes], [script name]).
    Using UndoModes.ENTIRE_SCRIPT doesn't make the script "cancelable" as a whole.

 

I would report to Adobe via a BUG REPORT in the uservoice. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

Oh no! I was hoping for an elegant answer. Thanks, Loic!

Mike Witherell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

I hope it might be wrong but this is how it looks like 😕

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

I tried it in the Adobe Developer Tool debugger, but my experience level is not deep enough. All I can see is that it fails to work and complains about it. 

Where is there a lookup of new commands vs. old commands?

Mike Witherell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

I am not aware of a comparison between ExtendScript and UXP so you have a state of the art but there is the official UXP InDesign DOM here:

https://developer.adobe.com/indesign/uxp/omv/

But as doScript method seems to demonstrate, being listed on this page, doesn't mean it's working fully.

Yet I am not surprised, it's not that long that UXP Scripting is available with InDesign and there will be gaps for a while.

Loic

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 12, 2022 Dec 12, 2022

Copy link to clipboard

Copied

Adobe confirmed that app.doScript() doesn't work yet in UXP, and that they're working on its implementation. There are still quite a lot of things that don't work yet, UXP scripting is still very much work in progress.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 12, 2022 Dec 12, 2022

Copy link to clipboard

Copied

Thanks Peter. I had assumed (I don't know why I would) that once introduced, UXP would be a fairly complete implementation, and that JSX stuff would be deprecated.

Mike Witherell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Dec 12, 2022 Dec 12, 2022

Copy link to clipboard

Copied

LATEST

I understand this ongoing process, it allows Adobe to move priorities-wise. For example, they now know they need to fix doScript ;). This is a transition time and ExtendScript will be there for as long as UXP isn't fully up to date. If you are a team, you can set resources on this ExtendScript to UXP transition. If you are a freelancer, you may stick to ExtendScript for nowand use UXP for your own use with the intention of finding areas to improve.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines