activeLayer.applyStyle not available issue

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

shan

activeLayer.applyStyle not available issue

Post by shan »

hi,

for the past few days i was using photoshop cs3 with the script to apply colors to the acitve layer as,
newDoc.activeLayer.applyStyle (val);

now i changed to photoshop cs5 and when i run the script, it shows the following error,
"newDoc.activeLayer.applyStyle (val); -- General Photoshop errro occured. This functionality may not be available in this version of photoshop."

how to rectify this???????????

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

Mike Hale

activeLayer.applyStyle not available issue

Post by Mike Hale »

Was it a custom style? Does the style exists in CS5?
txuku

activeLayer.applyStyle not available issue

Post by txuku »

Bonjour shan

Style must be loaded in the palette of styles.

Try this code :

Code: Select all//Pour charger un style dans la palette des styles

var FolderStyles = new Folder("C:/Program Files/Adobe/Adobe Photoshop CS5 (64 Bit)/Presets/Styles/");

nomClasseStyles = "Abstract Styles.asl";

chargerStyles( FolderStyles, nomClasseStyles )

function chargerStyles( FolderStyles, nomClasseStyles )
{
    var idsetd = charIDToTypeID( "setd" );
    var desc3 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref2 = new ActionReference();
        var idPrpr = charIDToTypeID( "Prpr" );
        var idStyl = charIDToTypeID( "Styl" );
        ref2.putProperty( idPrpr, idStyl );
        var idcapp = charIDToTypeID( "capp" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref2.putEnumerated( idcapp, idOrdn, idTrgt );
    desc3.putReference( idnull, ref2 );
    var idT = charIDToTypeID( "T   " );
    desc3.putPath( idT, new File( FolderStyles + "/" + nomClasseStyles ) );
    //desc3.putPath( idT, new File( "C:/Program Files/Adobe/Adobe Photoshop CS4 (64 Bit)/Presets/Styles/Glass Buttons.asl" ) );
    executeAction( idsetd, desc3, DialogModes.NO );
}



You can use StylesFile.js StylesFile.js of xbytor after having installed xtools to find the names of installed styles.
shan

activeLayer.applyStyle not available issue

Post by shan »

hi,

thanks for your replies.......
yes it is a custom style and it is there in the photoshop styles.........

also i have named my styles as Style 1, Style 2,.....
and hence iam applying in the code like,
newDoc.activeLayer.applyStyle(val[3]+" "+x);

please help me with the best solution...