executeAction( idsetd, desc6, DialogModes.NO );

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

bugno

executeAction( idsetd, desc6, DialogModes.NO );

Post by bugno »

Hi,
Photoshop CS4 I am trying to make a script using ScriptingListener but when I run it I receive an error message about
"ExecuteAction (idsetd, desc6, DialogModes.NO);"
saying that this feature may not be available for this version of photoshop???

Is that you have already encountered this problem?

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

larsen67

executeAction( idsetd, desc6, DialogModes.NO );

Post by larsen67 »

You will have to post your code that line on it's own means nothing…
Mike Hale

executeAction( idsetd, desc6, DialogModes.NO );

Post by Mike Hale »

Yes, you will have to post the rest of your code for us to tell what is wrong. From the line you did post it looks like you are trying to set a property but without know what property and target it's hard to say why you are getting that error.

But error messages in Photoshop are not as helpful as they once were. Now almost all errors have that same 'feature may not be available' message so the message itself doesn't really tell us what is wrong.
bugno

executeAction( idsetd, desc6, DialogModes.NO );

Post by bugno »

...sorry, here is my code

Code: Select all// Save the current preferences                             
var startRulerUnits = app.preferences.rulerUnits;             
var startTypeUnits = app.preferences.typeUnits;                 
var startDisplayDialogs = app.displayDialogs;   
                 
   app.preferences.rulerUnits = Units.CM;                   
   app.preferences.typeUnits = TypeUnits.POINTS;                 
   app.displayDialogs = DialogModes.NO;


// ask the user for the input folder - demander à l'utilisateur le dossier d'entrée
   var inputFolder = Folder.selectDialog("select source files") ;
 
// ask the user for the output folder
   var outputFolder = Folder.selectDialog("Select a folder for the output files");   
 
// see if we got something interesting from the dialog -
   if (inputFolder != null && outputFolder != null) {

// get all the files found in this folder - obtenir tous dossiers trouvés dans cette chemise
   var fileList = inputFolder.getFiles()
 

// open each one in turn - ouvrir chacun à leur tour
   for (var i = 0; i < fileList.length; i++) {
 
// The fileList includes both folders and files so open only files
   if (fileList instanceof File && fileList.hidden == false) {
 
// get a reference to the new document
   var docRef = open(fileList)
   
// =======================================================

// Supp tracés sauf 1
var idx = activeDocument.pathItems.length-1
while (activeDocument.pathItems.length > 1){
   activeDocument.pathItems[idx].remove();
   idx--;
   };



// Dupliquer Arriere Plan
var idDplc = charIDToTypeID( "Dplc" );
    var desc5 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref4 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref4.putEnumerated( idLyr, idOrdn, idTrgt );
    desc5.putReference( idnull, ref4 );
    var idVrsn = charIDToTypeID( "Vrsn" );
    desc5.putInteger( idVrsn, 2 );
executeAction( idDplc, desc5, DialogModes.NO );

// Récup tracé comme sélection
var idsetd = charIDToTypeID( "setd" );
    var desc190 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref99 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idfsel = charIDToTypeID( "fsel" );
        ref99.putProperty( idChnl, idfsel );
    desc190.putReference( idnull, ref99 );
    var idT = charIDToTypeID( "T   " );
        var ref100 = new ActionReference();
        var idPath = charIDToTypeID( "Path" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref100.putEnumerated( idPath, idOrdn, idTrgt );
    desc190.putReference( idT, ref100 );
    var idVrsn = charIDToTypeID( "Vrsn" );
    desc190.putInteger( idVrsn, 1 );
    var idvectorMaskParams = stringIDToTypeID( "vectorMaskParams" );
    desc190.putBoolean( idvectorMaskParams, true );
executeAction( idsetd, desc190, DialogModes.NO );

// Ajout masque de fusion
var idMk = charIDToTypeID( "Mk  " );
    var desc88 = new ActionDescriptor();
    var idNw = charIDToTypeID( "Nw  " );
    var idChnl = charIDToTypeID( "Chnl" );
    desc88.putClass( idNw, idChnl );
    var idAt = charIDToTypeID( "At  " );
        var ref42 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idChnl = charIDToTypeID( "Chnl" );
        var idMsk = charIDToTypeID( "Msk " );
        ref42.putEnumerated( idChnl, idChnl, idMsk );
    desc88.putReference( idAt, ref42 );
    var idUsng = charIDToTypeID( "Usng" );
    var idUsrM = charIDToTypeID( "UsrM" );
    var idRvlS = charIDToTypeID( "RvlS" );
    desc88.putEnumerated( idUsng, idUsrM, idRvlS );
executeAction( idMk, desc88, DialogModes.NO );


// Sélectionner Arrière plan
var idslct = charIDToTypeID( "slct" );
    var desc8 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref8 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        ref8.putName( idLyr, "Arriere-plan" );
    desc8.putReference( idnull, ref8 );
    var idMkVs = charIDToTypeID( "MkVs" );
    desc8.putBoolean( idMkVs, false );
executeAction( idslct, desc8, DialogModes.NO );


// Ajouter calque couleur unie blanc
var idMk = charIDToTypeID( "Mk  " );
    var desc9 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref9 = new ActionReference();
        var idcontentLayer = stringIDToTypeID( "contentLayer" );
        ref9.putClass( idcontentLayer );
    desc9.putReference( idnull, ref9 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc10 = new ActionDescriptor();
        var idType = charIDToTypeID( "Type" );
            var desc11 = new ActionDescriptor();
            var idClr = charIDToTypeID( "Clr " );
                var desc12 = new ActionDescriptor();
                var idRd = charIDToTypeID( "Rd  " );
                desc12.putDouble( idRd, 255.000000 );
                var idGrn = charIDToTypeID( "Grn " );
                desc12.putDouble( idGrn, 255.000000 );
                var idBl = charIDToTypeID( "Bl  " );
                desc12.putDouble( idBl, 255.000000 );
            var idRGBC = charIDToTypeID( "RGBC" );
            desc11.putObject( idClr, idRGBC, desc12 );
        var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
        desc10.putObject( idType, idsolidColorLayer, desc11 );
    var idcontentLayer = stringIDToTypeID( "contentLayer" );
    desc9.putObject( idUsng, idcontentLayer, desc10 );
executeAction( idMk, desc9, DialogModes.NO );

// Sélection calque dessus
var idslct = charIDToTypeID( "slct" );
    var desc13 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref10 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        ref10.putName( idLyr, "Arriere-plan copie" );
    desc13.putReference( idnull, ref10 );
    var idMkVs = charIDToTypeID( "MkVs" );
    desc13.putBoolean( idMkVs, false );
executeAction( idslct, desc13, DialogModes.NO );


// Ajout courbe
var idMk = charIDToTypeID( "Mk  " );
    var desc14 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref11 = new ActionReference();
        var idAdjL = charIDToTypeID( "AdjL" );
        ref11.putClass( idAdjL );
    desc14.putReference( idnull, ref11 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc15 = new ActionDescriptor();
        var idType = charIDToTypeID( "Type" );
            var desc16 = new ActionDescriptor();
            var idpresetKind = stringIDToTypeID( "presetKind" );
            var idpresetKindType = stringIDToTypeID( "presetKindType" );
            var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );
            desc16.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
        var idCrvs = charIDToTypeID( "Crvs" );
        desc15.putObject( idType, idCrvs, desc16 );
    var idAdjL = charIDToTypeID( "AdjL" );
    desc14.putObject( idUsng, idAdjL, desc15 );
executeAction( idMk, desc14, DialogModes.NO );




// =======================================================
var fileName = activeDocument.name.match(/([^\.]+)/)[1]
   

// here file is saved in folder 'proof' on the same level
var saveFile = new File(activeDocument.path.parent + "/proof/" + fileName + ".psd");
       
       
//change to whatever you want your tiff options to be
PhotoshopSaveOptions = new PhotoshopSaveOptions();
PhotoshopSaveOptions.embedColorProfile = true;

// save and close
docRef.saveAs( new File( outputFolder+ '/' +fileName + ".psd" ), PhotoshopSaveOptions );
docRef.close()


  }
 }
}

 // Reset the application preferences                     
  app.preferences.rulerUnits = startRulerUnits;
  app.preferences.typeUnits = startTypeUnits;                   
  app.displayDialogs = startDisplayDialogs; 



thank you very much
bugno

executeAction( idsetd, desc6, DialogModes.NO );

Post by bugno »

... I do not know if my procedure is good for what I want to say is, grab a selection from a path 1, duplicate the layer Background, apply a layer mask to this layer, insert between the two layers a layer of color.
I do not think my logic is correct in javascript to do what I want!
You can enlighten me on the way?
Mike Hale

executeAction( idsetd, desc6, DialogModes.NO );

Post by Mike Hale »

I am not sure what you are tying to do. And I didn't run your code but from looking at the code it looks like you are removing all the paths then after duplicating a layer trying to load a path as a selection.

I think you are getting an error because the paths have been removed and there is no path to load to a selection. At least that is the only setd executeAction I see in your full code. The line you first posted is not in the new code.
txuku

executeAction( idsetd, desc6, DialogModes.NO );

Post by txuku »

Bonjour bugno

Not sure but :

line 57 you must select "Path"
Code: Select all// =======================================================
var idslct = charIDToTypeID( "slct" );
    var desc2 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var idPath = charIDToTypeID( "Path" );
        var idWrPt = charIDToTypeID( "WrPt" );
        ref1.putProperty( idPath, idWrPt );
    desc2.putReference( idnull, ref1 );
executeAction( idslct, desc2, DialogModes.NO );


line 106 "Arrière-plan" instead of "Arriere-plan" and line 147 "Arrière-plan copie" instead of "Arriere-plan copie" !