Skip to main content
natrev
Legend
January 6, 2017
Answered

Get file path for preloaded Color Setting

  • January 6, 2017
  • 1 reply
  • 830 views

Hi

I tired a lot and having the headache due to finding the file path for loaded color setting.

First I know, is this possible to get loaded color setting path?

Please suggest me.

-yajiv

This topic has been closed for replies.
Correct answer JavierAroche

Hey natrev​, try this:

var ref = new ActionReference();

ref.putProperty( stringIDToTypeID("property"), stringIDToTypeID("colorSettings") )

ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 

var appDesc = executeActionGet(ref);

var colorSettingsObject = appDesc.getObjectValue( stringIDToTypeID('colorSettings') );

var colorSettingsPath = undefined;

if( colorSettingsObject.hasKey( stringIDToTypeID('using') ) ) {

     colorSettingsPath = colorSettingsObject.getPath( stringIDToTypeID('using') );

}

If you have a loaded color setting, the variable colorSettingsPath will return the path to the file, otherwise it will return undefined.

Hope it helps!

1 reply

JavierAroche
JavierArocheCorrect answer
Inspiring
January 7, 2017

Hey natrev​, try this:

var ref = new ActionReference();

ref.putProperty( stringIDToTypeID("property"), stringIDToTypeID("colorSettings") )

ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 

var appDesc = executeActionGet(ref);

var colorSettingsObject = appDesc.getObjectValue( stringIDToTypeID('colorSettings') );

var colorSettingsPath = undefined;

if( colorSettingsObject.hasKey( stringIDToTypeID('using') ) ) {

     colorSettingsPath = colorSettingsObject.getPath( stringIDToTypeID('using') );

}

If you have a loaded color setting, the variable colorSettingsPath will return the path to the file, otherwise it will return undefined.

Hope it helps!

natrev
natrevAuthor
Legend
January 9, 2017

Hi JavierAroche,

It is working like charm..

-yajiv