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

suspendHistory breaks activeHistoryState

Advocate ,
Aug 20, 2014 Aug 20, 2014

Copy link to clipboard

Copied

Hi,

I've found that when you try to get the activeHistoryState after a suspendHistory call, you get the wrong one, namely the previous - e.g.

var doc = app.activeDocument;

$.writeln(doc.activeHistoryState); // [HistoryState DemoFile.jpg]

doc.suspendHistory ("TEST", "doc.activeLayer.name = 'Something'; doc.activeLayer.name = 'SomethingElse';");

$.writeln(doc.activeHistoryState); // [HistoryState DemoFile.jpg]

// shouldn't be [HistoryState TEST] ?

Why is it this way? Any workaround?

I've also tried using doc.historyStates.getByName('TEST'); but fires an error - it seems like the state hasn't been created.

Any help is really appreciated, thank you!

Davide Barranca

---

www.davidebarranca.com

www.cs-extensions.com

TOPICS
Actions and scripting

Views

1.3K

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

correct answers 1 Correct answer

Advocate , Aug 25, 2014 Aug 25, 2014

FYI,

Michel Mariani suggested this workaround:

var doc = app.activeDocument; 

$.writeln(doc.activeHistoryState); // [HistoryState DemoFile.jpg]

doc.suspendHistory ("TEST", "doc.activeLayer.name = 'Something'; doc.activeLayer.name = 'SomethingElse';");

app.refresh();

$.writeln(doc.activeHistoryState); // [HistoryState TEST] 

It adds the usual, unwanted delay app.refresh adds, but at least the history state is the right one. Thanks Michel!

Davide Barranca

---

www.davidebarranca.com

www.cs-extensio

...

Votes

Translate

Translate
Adobe
Advocate ,
Aug 25, 2014 Aug 25, 2014

Copy link to clipboard

Copied

FYI,

Michel Mariani suggested this workaround:

var doc = app.activeDocument; 

$.writeln(doc.activeHistoryState); // [HistoryState DemoFile.jpg]

doc.suspendHistory ("TEST", "doc.activeLayer.name = 'Something'; doc.activeLayer.name = 'SomethingElse';");

app.refresh();

$.writeln(doc.activeHistoryState); // [HistoryState TEST] 

It adds the usual, unwanted delay app.refresh adds, but at least the history state is the right one. Thanks Michel!

Davide Barranca

---

www.davidebarranca.com

www.cs-extensions.com

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
Feb 22, 2019 Feb 22, 2019

Copy link to clipboard

Copied

I've logged this issue. Only work around is the slow app.refresh unfortunately.

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 ,
Feb 22, 2019 Feb 22, 2019

Copy link to clipboard

Copied

LATEST

Photoshop scripting also runs  into this problems and revert document to state previous to the execution of the script when a script move/resize tramsform a layer when there is an active selection.  I reported that bug years ago Adobe acknowledge the bug but does not care to fix it.  I saw at least one scripting thread where a user was backed up  three states they were bitten three times.

Photoshop: Script bug resize layer back document up one history state | Photoshop Family Customer Co...

Still seems to be in all release of Photoshop.

I believe Photoshop scripting expected  that something it did regarding the active selection would create a history state it need to remove but the history state  was not created because the script had suspended history state.

Adobe even assign a programmer to fix a bug I reported about Bad option added to CS4 when Adobe added the Adjustment panel.   The Programmed never removed the bad options, They are still in the Adjustment Panel fly-out menu.

It would be better if Adobe fixed acknowledged bugs not just log them..

JJMack

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