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

Please help, error when placedLayerEditContents.

Explorer ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

Hello,

when i use code bellow

'app.activeDocument.activeLayer = layer
executeAction( sTT('placedLayerEditContents'), undefined, DialogModes.NO );'

 

error occured: The command edit content is not currently available.

what is wrong??

 

Thanks so much

TOPICS
Actions and scripting

Views

575

Likes

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
LEGEND ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

In CS6 it says: Could not edit original smart object because file name was not valid.

 

Edit: Ops! In CC too by scripting when dialog mode is set to all. So no difference.

Likes

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
Valorous Hero ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

There is still another situation. Usually smart objects are formed as Layer1.psb or similar. When edited, this file is created in the temporary folder. If such a file exists (for example, another smart object with the same name was recently edited), then an attempt is made to create a Layer11.psb file. If such a file already exists, it tries to create Layer111.psb and so on. One day, with a very long file name, an error occurs, or it cannot already come up with a new unique name.

Likes

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
LEGEND ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

That's funny you say it, as I just finished watching a science video about infinity.

Likes

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 ,
Sep 04, 2021 Sep 04, 2021

Copy link to clipboard

Copied

LATEST

Likes

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
LEGEND ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

There's lack of assigned expFile variable and some functions from in _trySaveImage one.

Likes

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
LEGEND ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

You also need to be careful in you script when it come to  opening a smart object layer's object to edits its content.  If the layer's object  is a vector image  or a camera raw image the  object will open in application  or Plug-in that processes those images formats  AI or ACR your Photoshop Script's next statement would be executed after AI of ACR  is done the object would or would not have been updated the  object work document would not be open in Photoshop.  I use code that  r-bin posted to test the smart object and bypass vector and Raw object in my mockup scripts for Photoshop does not  have  support for vector and raw image formats.   

 

I have also has issues where the Object work file created in temp by Photoshop did not open in Photoshop  I had the add some code to handle the problem if/when it occured.

 

////// open smart object //////
function openSmartObject (theLayer) {
	current = app.activeDocument;
	if (theLayer.kind == "LayerKind.SMARTOBJECT") {
		runMenuItem(stringIDToTypeID('placedLayerEditContents'));
		if ( current == app.activeDocument) {
			try {         
				var r = new ActionReference();     
				r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("smartObject"));  
				r.putIdentifier(stringIDToTypeID("layer"), theLayer.id);  
				var name = executeActionGet(r).getObjectValue(stringIDToTypeID("smartObject")).getString(stringIDToTypeID("fileReference"));         
				}  
			catch (e) { throw theLayer + " Smart Object Did not Open"; }  
			var workFile = new File(Folder.temp + "/" +  name);  // May work for both Windows and Mac
			if (workFile.exists) app.open(File(workFile));
			if ( current == app.activeDocument) throw theLayer + " Smart Object Did not Open";
		}
	}
	return app.activeDocument
};

 

JJMack

Likes

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