Skip to main content
Inspiring
August 24, 2022
Answered

Photoshop preferences

  • August 24, 2022
  • 3 replies
  • 940 views

Is there a way or script to change items in photoshop preferences.

This topic has been closed for replies.
Correct answer jazz-y

@ jazzy-y The script works fine, but I would like if changes were possible When I open the photo in camera raw and apply super resolution it saves me the photo in dng. This is not good for me I would like you to save me the jpg at the highest quality and not the dng. I hope you can help me


see Improve image quality using Camera Raw 

According to the description of this function, the result is stored only in DNG. That is, after applying the function, you need to re-open the file with the same name, but with a DNG extension, and save it as a JPG. Something like that:

var myFile = (new File()).openDlg();

try {
    (d = new ActionDescriptor()).putPath(stringIDToTypeID('null'), myFile);
    d.putBoolean(stringIDToTypeID('overrideOpen'), true);
    var d1 = new ActionDescriptor();
    d.putObject(stringIDToTypeID('as'), stringIDToTypeID('Adobe Camera Raw'), d1);
    executeAction(stringIDToTypeID('open'), d, DialogModes.ALL);
} catch (e) { }

var dngName = new RegExp(encodeURI(decodeURI(myFile.name).replace(/\.[0-9a-z]+$/, '')) + '.+?\.dng', 'i'),
    dngFile = (Folder(myFile.path)).getFiles(dngName);

if (dngFile.length) {
    app.open(dngFile[0])
    activeDocument.saveAs(File(dngFile[0]), function () { var o = new JPEGSaveOptions; o.quality = 12; return o }())
    activeDocument.close()
    dngFile[0].remove()
}

 

3 replies

Legend
August 24, 2022

At any time, you can open a supported file using camera Raw with:

 

var myFile = new File( '/e/myTestJPG.jpg');
(d = new ActionDescriptor()).putPath(stringIDToTypeID('null'), myFile);
d.putBoolean(stringIDToTypeID('overrideOpen'), true);
var d1 = new ActionDescriptor();
d.putObject(stringIDToTypeID( 'as' ), stringIDToTypeID( 'Adobe Camera Raw' ), d1 );  
executeAction(stringIDToTypeID('open'), d, DialogModes.ALL);

 

Inspiring
August 24, 2022

@jazz-y
I tried the script but it opens the photo in photoshop and not in camera raw?

 

Legend
August 24, 2022

I tested the code on windows 7 CC2020 + camera raw 13, windows 11 CC2022 + camera raw 14 and on MacOs BigSur CC2022 + camera raw 14. I didn't notice any problems anywhere. Did you change the filename? Try this way:

var myFile = (new File()).openDlg();
(d = new ActionDescriptor()).putPath(stringIDToTypeID('null'), myFile);
d.putBoolean(stringIDToTypeID('overrideOpen'), true);
var d1 = new ActionDescriptor();
d.putObject(stringIDToTypeID( 'as' ), stringIDToTypeID( 'Adobe Camera Raw' ), d1 );  
executeAction(stringIDToTypeID('open'), d, DialogModes.ALL);

Do you have a CameraRaw filter in your filter menu?

Stephen Marsh
Community Expert
Community Expert
August 24, 2022

Yes, many, but not all...

 

For some of the prefs, there is standard DOM code. For example, one of the most common is ruler units:

 

https://theiviaxx.github.io/photoshop-docs/Photoshop/Preferences.html

 

app.preferences.rulerUnits = Units.PIXELS;

 

 

For others not found in the standard DOM, advanced users write Action Manager code, the rest of us record AM code via the Scripting Listener plugin (if available for recording, not all are):

 

https://helpx.adobe.com/au/photoshop/kb/downloadable-plugins-and-content.html#ScriptingListenerplugin

 

skipTransformWhenPlacing(false);

function skipTransformWhenPlacing(theBool) {
var idset = stringIDToTypeID( "set" );
    var desc2 = new ActionDescriptor();
    var idnull = stringIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var idproperty = stringIDToTypeID( "property" );
        var idgeneralPreferences = stringIDToTypeID( "generalPreferences" );
        ref1.putProperty( idproperty, idgeneralPreferences );
        var idapplication = stringIDToTypeID( "application" );
        var idordinal = stringIDToTypeID( "ordinal" );
        var idtargetEnum = stringIDToTypeID( "targetEnum" );
        ref1.putEnumerated( idapplication, idordinal, idtargetEnum );
    desc2.putReference( idnull, ref1 );
    var idto = stringIDToTypeID( "to" );
        var desc3 = new ActionDescriptor();
        var idextensionsOn = stringIDToTypeID( "extensionsOn" );
        desc3.putBoolean( idextensionsOn, false );
        var idskipTransformSOFromLibrary = stringIDToTypeID( "skipTransformSOFromLibrary" );
        desc3.putBoolean( idskipTransformSOFromLibrary, theBool );
    var idgeneralPreferences = stringIDToTypeID( "generalPreferences" );
    desc2.putObject( idto, idgeneralPreferences, desc3 );
executeAction( idset, desc2, DialogModes.NO );
}

 

 

Inspiring
August 24, 2022

i downloaded scripenlistenerplugin but it didn't log anything

you have a solution to enable that voice

 

Stephen Marsh
Community Expert
Community Expert
August 24, 2022

Sadly that is so, not everything can be recorded into an Action or recorded as AM code from the SL plugin. It may be possible with advanced AM coding knowledge.

Inspiring
August 24, 2022

Here so I am more precise

what i want to do and enable this item in the photoshop preferences menu
enable the item to open jpg files directly in camera raw.

 

 

Stephen Marsh
Community Expert
Community Expert
August 24, 2022

Ah, now that you show Camera Raw Preferences, that is one that can't be recorded... So if it is possible, it would take a user with advanced knowledge of writing Action Manager code. Sorry, I can't help with that, but others such as @r-bin and @jazz-y might be able to help...