Skip to main content
martink15467522
Inspiring
January 21, 2022
Question

Update all linked smart objects CC2019 script not working in CC2020 and 2021

  • January 21, 2022
  • 2 replies
  • 6030 views

Hello!

 

I am trying to use the following script to update all linked smart objects.  https://stackoverflow.com/questions/62280806/photoshop-cc2019-auto-update-all-linked-smart-objects-including-nested-ones/

 

But the script does not seem to be working in 2020 and 2021. It just closes the file. 

Either something is wrong with my layer structure, or is the script doing something wrong. Maybe anyone can give some advice on solving this?

 

 

 

This topic has been closed for replies.

2 replies

Legend
January 22, 2022

I didn't go into the script and didn't check,

but try replacing the line

app.runMenuItem(stringIDToTypeID('placedLayerEditContents'));

with this code

var doc0 = app.activeDocument;
app.runMenuItem(stringIDToTypeID('placedLayerEditContents'));
if (doc0 != app.activeDocument) { alert("can't open smart object"); throw("error"); }

 

And also in the same function replace the line 

app.activeDocument.close(SaveOptions.SAVECHANGES);

with this

app.activeDocument.close(SaveOptions.SAVECHANGES);
app.activeDocument = doc0;

 

martink15467522
Inspiring
January 24, 2022

Tried this. Now the script opens the first smart object and immediately throws the error 

can't open smart object

 

martink15467522
Inspiring
January 26, 2022

After opening the smart object for editing use:

refresh()

Tried it. Script almost works now, but still too fast. For example, if I have 12 linked smart objects in a psd, it manages to update 8, and the last 4 do not. How many refreshes would it be reasonable to use? more than one is too much?

martink15467522
Inspiring
January 21, 2022

From extendscript i get an error at line 69

 

autoupdateAllSmartObjects(app.activeDocument, stackNr);  -- no such element