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

Brainiac
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
February 14, 2022

I put both files at end 'D:\AI' path, so 'Test.psd' smart objects could see linked 'A190.ai' file. The links were broken and the objects were red. After running the script the links were fixed while the objects turned into green. The script worked flawlessly again for me.


Can i report this as a bug? Currently it seems that only my computers are having difficulties running the script.

martink15467522
Inspiring
January 21, 2022

From extendscript i get an error at line 69

 

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