Copy link to clipboard
Copied
Is there a way or script to change items in photoshop preferences.
2 Correct answers
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 );
exe
...
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();
...
Explore related tutorials & articles
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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):
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 );
}
Copy link to clipboard
Copied
i downloaded scripenlistenerplugin but it didn't log anything
you have a solution to enable that voice
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
@jazz-y
I tried the script but it opens the photo in photoshop and not in camera raw?
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
@ jazz-y
Now it works perfectly
thanks you are a great teacher.
Copy link to clipboard
Copied
@ 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
Copy link to clipboard
Copied
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()
}
Copy link to clipboard
Copied
It works like magic
thanks for your great help

