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

Embed linked image by javascript

Guest
Jan 25, 2020 Jan 25, 2020

Hey guys im getting an error for using the action script listener for embed linked image.

 

Here's the error:

embed error.png

 

and here's the code I used:

 

EmbedImg();
function EmbedImg()
{
    var idplacedLayerConvertToEmbedded = stringIDToTypeID"placedLayerConvertToEmbedded" );
    executeActionidplacedLayerConvertToEmbeddedundefinedDialogModes.NO );
}
 
I tried to catch and ignore the error, but it only works on the first linked image. I have the latest version of photoshop.
 
try 
{
      EmbedImg();
catch (ignored) {}
                        
TOPICS
Actions and scripting
1.0K
Translate
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

Mentor , Jan 25, 2020 Jan 25, 2020

Before calling this function, you must make active or select (one or more) layers.

If you need to convert all layers of a document, then instead of selecting them in a loop, easier to do this:

 

 

var idplacedLayerEmbedAll = stringIDToTypeID( "placedLayerEmbedAll" );
executeAction( idplacedLayerEmbedAll, undefined, DialogModes.NO );

 

 

 

Translate
Adobe
Mentor ,
Jan 25, 2020 Jan 25, 2020

Before calling this function, you must make active or select (one or more) layers.

If you need to convert all layers of a document, then instead of selecting them in a loop, easier to do this:

 

 

var idplacedLayerEmbedAll = stringIDToTypeID( "placedLayerEmbedAll" );
executeAction( idplacedLayerEmbedAll, undefined, DialogModes.NO );

 

 

 

Translate
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 ,
Jan 25, 2020 Jan 25, 2020
LATEST

My suggestion is very close to the one supplied by Dmitry:

 

 

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

 

 

or

 

app.runMenuItem(stringIDToTypeID('placedLayerEmbedAll'));
Translate
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