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

need the script code for saving color settings and give a name

Community Beginner ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

Hello guys,

I cannot get the code for saving only color settings to file and give it a  name. it is a .csf file that saved in \Adobe\Color\Settings folder.

the script listener seem doesn't get the code working.  I got this:

var idmodalStateChanged = stringIDToTypeID( "modalStateChanged" );

    var desc30 = new ActionDescriptor();

    var idLvl = charIDToTypeID( "Lvl " );

    desc30.putInteger( idLvl, 1 );

    var idStte = charIDToTypeID( "Stte" );

    var idStte = charIDToTypeID( "Stte" );

    var identer = stringIDToTypeID( "enter" );

    desc30.putEnumerated( idStte, idStte, identer );

    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );

    desc30.putBoolean( idkcanDispatchWhileModal, true );

    var idTtl = charIDToTypeID( "Ttl " );

    desc30.putString( idTtl, """Color Settings""" );

executeAction( idmodalStateChanged, desc30, DialogModes.NO );

// =======================================================

var idmodalStateChanged = stringIDToTypeID( "modalStateChanged" );

    var desc31 = new ActionDescriptor();

    var idLvl = charIDToTypeID( "Lvl " );

    desc31.putInteger( idLvl, 0 );

    var idStte = charIDToTypeID( "Stte" );

    var idStte = charIDToTypeID( "Stte" );

    var idexit = stringIDToTypeID( "exit" );

    desc31.putEnumerated( idStte, idStte, idexit );

    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );

    desc31.putBoolean( idkcanDispatchWhileModal, true );

    var idTtl = charIDToTypeID( "Ttl " );

    desc31.putString( idTtl, """Color Settings""" );

executeAction( idmodalStateChanged, desc31, DialogModes.NO );

Thanks very much.

TOPICS
Actions and scripting

Views

782

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

correct answers 1 Correct answer

Community Expert , Mar 18, 2019 Mar 18, 2019

That scriptlistener code Is not actually for  editing and saving your Photoshop Color setting.   Not everything you do in Photoshop is record able and script able.    You really need to know how Photoshop Manager code works and be able to scrip the get reference area to retrieve  Information like current settings.   Scriptlistener plug-in only seems to record the execution part of action manager code. not the get reference part. So you can try to see if Scriptlistener can record something like m

...

Votes

Translate

Translate
Adobe
Adobe Employee ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

Moved to Photoshop Scripting

Votes

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 ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

That scriptlistener code Is not actually for  editing and saving your Photoshop Color setting.   Not everything you do in Photoshop is record able and script able.    You really need to know how Photoshop Manager code works and be able to scrip the get reference area to retrieve  Information like current settings.   Scriptlistener plug-in only seems to record the execution part of action manager code. not the get reference part. So you can try to see if Scriptlistener can record something like menu Edit>color settings... to have an interactive script.

So you could record and interactive  menu Edit>Color Settings.    To see if you edit Color setting and use save and load color setting files gets recorded.  You may be able to save settings to a file and load settings from a file using executeAction.

r-bin know action manager code is capable of.  Perhaps he can retrieve and set Photoshop Color setting with action manager code.  That above my pay grade.

When ever I see "modalStateChanged"  I normall considef the junk code. Sometime is=t actually is not and mas required. Again above my pay gtade.

I did a quicktry toe see what would be rescided to thing like and interactive Edit color settinge and save ald loaf color settibf fri a file.  The steps als seem to follow a "modalStateChanged"  besa a ster followed  he a "modalStateChanged"   Con bot get the core to work when I renoved the  junk "modalStateChanged" steps.

Here is the scriptlistener code that looked good to me: Butt did not seem to work for me.

// =======================================================

var idsetd = charIDToTypeID( "setd" );

    var desc26 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref10 = new ActionReference();

        var idPrpr = charIDToTypeID( "Prpr" );

        var idcolorSettings = stringIDToTypeID( "colorSettings" );

        ref10.putProperty( idPrpr, idcolorSettings );

        var idcapp = charIDToTypeID( "capp" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idTrgt = charIDToTypeID( "Trgt" );

        ref10.putEnumerated( idcapp, idOrdn, idTrgt );

    desc26.putReference( idnull, ref10 );

executeAction( idsetd, desc26, DialogModes.NO );

save

// =======================================================

var idsetd = charIDToTypeID( "setd" );

    var desc38 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref13 = new ActionReference();

        var idPrpr = charIDToTypeID( "Prpr" );

        var idcolorSettings = stringIDToTypeID( "colorSettings" );

        ref13.putProperty( idPrpr, idcolorSettings );

        var idcapp = charIDToTypeID( "capp" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idTrgt = charIDToTypeID( "Trgt" );

        ref13.putEnumerated( idcapp, idOrdn, idTrgt );

    desc38.putReference( idnull, ref13 );

    var idT = charIDToTypeID( "T   " );

        var desc39 = new ActionDescriptor();

        var idUsng = charIDToTypeID( "Usng" );

        desc39.putPath( idUsng, new File( "C:\\Users\\jjmac\\Desktop\\SavecColorSettings.csf" ) );

    var idcolorSettings = stringIDToTypeID( "colorSettings" );

    desc38.putObject( idT, idcolorSettings, desc39 );

executeAction( idsetd, desc38, DialogModes.NO );

load

// =======================================================

var idsetd = charIDToTypeID( "setd" );

    var desc31 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref12 = new ActionReference();

        var idPrpr = charIDToTypeID( "Prpr" );

        var idcolorSettings = stringIDToTypeID( "colorSettings" );

        ref12.putProperty( idPrpr, idcolorSettings );

        var idcapp = charIDToTypeID( "capp" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idTrgt = charIDToTypeID( "Trgt" );

        ref12.putEnumerated( idcapp, idOrdn, idTrgt );

    desc31.putReference( idnull, ref12 );

    var idT = charIDToTypeID( "T   " );

        var desc32 = new ActionDescriptor();

        var idUsng = charIDToTypeID( "Usng" );

        desc32.putPath( idUsng, new File( "C:\\Users\\jjmac\\AppData\\Roaming\\Adobe\\Color\\jjmackProPhotoRGB.csf" ) );

    var idcolorSettings = stringIDToTypeID( "colorSettings" );

    desc31.putObject( idT, idcolorSettings, desc32 );

executeAction( idsetd, desc31, DialogModes.NO );

JJMack

Votes

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 Beginner ,
Mar 19, 2019 Mar 19, 2019

Copy link to clipboard

Copied

Thanks. It's very helpful.

Votes

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 ,
Mar 19, 2019 Mar 19, 2019

Copy link to clipboard

Copied

Sorry about my typing never was able to learn that skill. One of the reasons I only hack at scripting from time to time.  Not knowing JavaScript is an other.

JJMack

Votes

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
New Here ,
Mar 27, 2020 Mar 27, 2020

Copy link to clipboard

Copied

LATEST

Hi, 

the code for saving and loading seem to the same (except the variable names).

If I use the code for saving, colorSettings will be loaded!

 

How can I save current colorSettings?

 

Best regards

J.

Votes

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