Skip to main content
Participating Frequently
August 10, 2016
Question

activeHistoryState after changing activeDocument doesn't work at all.

  • August 10, 2016
  • 3 replies
  • 1818 views

Hey.

I have a script, which basicly changes activeDocument to doc_a, then it changes activeDocument back do doc_b and tries to check activeDocument.activeHistoryState here. It always stops executing here and I get "General Photoshop error occured. This functionality may not be available in this version of Photoshop.". Any ideas how to solve this?

The code for reproducing this bug:

app.activeDocument = app.documents[0];

app.activeDocument = app.documents[1];

$.writeln(app.activeDocument.activeHistoryState);

Thanks!

This topic has been closed for replies.

3 replies

Tom Ruark
Inspiring
August 23, 2016

We are looking into why this refresh is needed. It should not be. Stay tuned...

Tom Ruark
Inspiring
November 3, 2016

Try with CC 2017. I believe we fixed this issue.

August 22, 2016

You may want to try to add an app.refresh () statement before reading the new active history state. It did solve a somehow related problem:

suspendHistory breaks activeHistoryState

app.activeDocument = app.documents[0];

app.activeDocument = app.documents[1];

app.refresh();

$.writeln(app.activeDocument.activeHistoryState);

HTH...

--Mikaeru

lukaszmtwAuthor
Participating Frequently
August 22, 2016

This works, but it adds a weird unwanted delay. I want to built a script that saves me time... Anyway thanks for that! If someone can find a way to do it without the delay I would truly appreciate it.

JJMack
Community Expert
Community Expert
August 22, 2016

That is why I suggested trying a delay loop some kind programmed pause.  The app.refresh(); must be used at times its delay may be longer then needed and not desired.  You should report this as a bug to Adobe.  Adobe need to interlock the statement "app.activeDocument = document;"  for correct operation the switch document operation must be complete before the next script statement is started. CS6 had an interlock bug like this when first released many of my actions and scripts would fail with such or such was not available because a document switch operation was not yet completed. My script would close a document it had open which would cause Photoshop the switch to the previous document.  My scripts or actions next step would sometime fail because the document switch had not completed so there was no active document and the step required one.

JJMack
SuperMerlin
Inspiring
August 10, 2016

No error here running CS6 with Windows 10 Pro.

Maybe down to the version you are using ?

lukaszmtwAuthor
Participating Frequently
August 22, 2016

I'm using CC2015.5 but it's the same for CC2014 as I remember.

JJMack
Community Expert
Community Expert
August 22, 2016

The problem sound like the document switch did not complete there would be no active document so no history states. try adding a delay between the document switch and  using the history state. a do nothing loop.

JJMack