call a third-party plugin in script

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

rhytha

call a third-party plugin in script

Post by rhytha »

Hi,

Can anyone one help me on this, i have a third-party plugin installed, and i want to call this plugin which will pop-up a dialog box which i need to fill with text. Below you can find the code for the scriptlogger code generated when i run this plugin, how do i call this in a js.

Code: Select all// =======================================================
var id5 = charIDToTypeID( "Ply " );
    var desc2 = new ActionDescriptor();
    var id6 = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var id7 = charIDToTypeID( "Actn" );
        ref1.putName( id7, "TEXT_2" );
        var id8 = charIDToTypeID( "ASet" );
        ref1.putName( id8, "NIGHTTRAIN_TEXT" );
    desc2.putReference( id6, ref1 );
executeAction( id5, desc2, DialogModes.NO );

// =======================================================
var id13 = charIDToTypeID( "Ply " );
    var desc4 = new ActionDescriptor();
    var id14 = charIDToTypeID( "null" );
        var ref2 = new ActionReference();
        var id15 = charIDToTypeID( "Actn" );
        ref2.putName( id15, "open photofont" );
        var id16 = charIDToTypeID( "ASet" );
        ref2.putName( id16, "NIGHTTRAIN_TEXT" );
    desc4.putReference( id14, ref2 );
executeAction( id13, desc4, DialogModes.NO );


thank you

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

call a third-party plugin in script

Post by Mike Hale »

The code you post is not calling a plug-in. It is calling an action. Perhaps the action calls the plug-in.

But to answer your question, the code you posted is javascript. executeAction, charIDToTypeID, etc are part of the Photoshop javascript DOM. However I do understand what you are asking. To do this using a DOM method you would use.
Code: Select allapp.doAction("TEXT_2","NIGHTTRAIN_TEXT");
rhytha

call a third-party plugin in script

Post by rhytha »

Mike, thanks for the reply.
Sorry, yes its calling a action.

The below code calls the plugin, can you tell me how i can call the code in js.

Code: Select allvar id30 = charIDToTypeID( "phF1" );
    var desc6 = new ActionDescriptor();
    var id31 = charIDToTypeID( "Txt " );
    desc6.putString( id31, "M" );
    var id32 = charIDToTypeID( "FntN" );
    desc6.putString( id32, "TEST3" );
    var id33 = charIDToTypeID( "Hght" );
    desc6.putInteger( id33, 18 );
executeAction( id30, desc6, DialogModes.NO );


thank you
xbytor

call a third-party plugin in script

Post by xbytor »

That is JS code. If you want to call it like a function, you have to clean it up:

Code: Select allfunction callPlugin(text, font, size) {
  var id30 = charIDToTypeID( "phF1" );
     var desc6 = new ActionDescriptor();
     var id31 = charIDToTypeID( "Txt " );
     desc6.putString( id31, text);
     var id32 = charIDToTypeID( "FntN" );
     desc6.putString( id32, font );
     var id33 = charIDToTypeID( "Hght" );
     desc6.putInteger( id33, size);
  executeAction( id30, desc6, DialogModes.NO );
}

callPlugin("M", "TEST3", 180);