Copy link to clipboard
Copied
Hello,
I'm looking for a way to open Camera Raw with setting of the image in use.
How can I edit this code to replace the content of "desc368" with "CameraRAWSettingsType.SELECTEDIMAGE" if this is the right way to do it?
// ======================================================= code generated by ScriptListner
var idsetd = charIDToTypeID( "setd" );
var desc366 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref12 = new ActionReference();
var idfilterFX = stringIDToTypeID( "filterFX" );
ref12.putIndex( idfilterFX, 1 );
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref12.putEnumerated( idLyr, idOrdn, idTrgt );
desc366.putReference( idnull, ref12 );
var idfilterFX = stringIDToTypeID( "filterFX" );
var desc367 = new ActionDescriptor();
var idFltr = charIDToTypeID( "Fltr" );
var desc368 = new ActionDescriptor();
var idCrVe = charIDToTypeID( "CrVe" );
desc368.putString( idCrVe, """15.2""" );
var idPrVN = charIDToTypeID( "PrVN" );
desc368.putInteger( idPrVN, 5 );
var idPrVe = charIDToTypeID( "PrVe" );
desc368.putInteger( idPrVe, 184549376 );
var idExonetwo = charIDToTypeID( "Ex12" );
desc368.putDouble( idExonetwo, -0.660000 );
var idCronetwo = charIDToTypeID( "Cr12" );
desc368.putInteger( idCronetwo, 5 );
var idHionetwo = charIDToTypeID( "Hi12" );
desc368.putInteger( idHionetwo, -35 );
var idShonetwo = charIDToTypeID( "Sh12" );
desc368.putInteger( idShonetwo, 30 );
var idWhonetwo = charIDToTypeID( "Wh12" );
desc368.putInteger( idWhonetwo, 50 );
var idBkonetwo = charIDToTypeID( "Bk12" );
desc368.putInteger( idBkonetwo, -32 );
var idVibr = charIDToTypeID( "Vibr" );
desc368.putInteger( idVibr, 20 );
var idStrt = charIDToTypeID( "Strt" );
desc368.putInteger( idStrt, 4 );
var idAdobeCameraRawFilter = stringIDToTypeID( "Adobe Camera Raw Filter" );
desc367.putObject( idFltr, idAdobeCameraRawFilter, desc368 );
var idfilterFX = stringIDToTypeID( "filterFX" );
desc366.putObject( idfilterFX, idfilterFX, desc367 );
executeAction( idsetd, desc366, DialogModes.ALL );
@Stephen Marsh , could you please test this?
// =======================================================
var idfilterFX = stringIDToTypeID( "filterFX" );
var desc5 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putIndex( idfilterFX, 1 );
ref1.putEnumerated( stringIDToTypeID( "layer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc5.putReference( stringIDToTypeID( "null" ), ref1 );
var desc6 = new ActionDescriptor...
Copy link to clipboard
Copied
I am not sure what you mean exactly.
Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Options Bar, …) respectively the ACR dialog visible?
Copy link to clipboard
Copied
Hello,
My goal was to build an action to :
1 : Open the PSD file via batch mode
2 : Select the “Layer 0”
3 : Edit the Camera Raw smart filter
4 : I edit manually the filter (not the same values for each file)
5 : Save the file.
The problem with an action is that in step 3, the Camera Raw filter is not loaded with the parameters of the PSD file used but with the parameters of the PSD file that I used to record the action.
So I'm looking to work around this problem via a script, but with a script generated with ScriptListener I have the same problem. I cannot load Camera Raw with the settings of the PSD used
Copy link to clipboard
Copied
Please provide meaningful screenshots.
Does the Layer already have the Smart Filter applied at the beginning of the Action?
Copy link to clipboard
Copied
Hello @c.pfaffenbichler
Yes : all PSD files have the same structure like the screen shoot in the previous message.
- Layer 0 : Smart Layer + Camera Raw Filter
- Color File 1
Copy link to clipboard
Copied
I know of no equivalent in scripting for the manual action of right-clicking on a smart filer and selecting the "Edit Smart Filter..." command (same as double-clicking on the smart filter).
Hacking at the SL code, I can add a new camera raw filter or reset an existing one to zero/default values – but not open it retaining the current values.
Copy link to clipboard
Copied
That my problem too. I was hopping to find a way to add "CameraRAWSettingsType.SELECTEDIMAGE" into the script but I can't find how.
Copy link to clipboard
Copied
"CameraRAWSettingsType.SELECTEDIMAGE"
Where did you get that?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Here https://theiviaxx.github.io/photoshop-docs/Photoshop/CameraRAWSettingsType.html
That’s DOM code.
Copy link to clipboard
Copied
@Stephen Marsh , could you please test this?
// =======================================================
var idfilterFX = stringIDToTypeID( "filterFX" );
var desc5 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putIndex( idfilterFX, 1 );
ref1.putEnumerated( stringIDToTypeID( "layer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc5.putReference( stringIDToTypeID( "null" ), ref1 );
var desc6 = new ActionDescriptor();
var idfilter = stringIDToTypeID( "filter" );
desc5.putObject( idfilterFX, idfilterFX, desc6 );
executeAction( stringIDToTypeID( "set" ), desc5, DialogModes.ALL );
Copy link to clipboard
Copied
It's working like a charm !! 🙂
Thanks a lot.
Copy link to clipboard
Copied
Sorry, I have been flat out with work – no time for play.
Yes, this is great, more concise than what I finally came up with as you know AM code better than me. I just hack at it until something works (most of the time I just break it).
This is what I came up with to open the Camera Raw Smart Filter without changing the existing CRS values:
try {
var idset = stringIDToTypeID("set");
var desc189 = new ActionDescriptor();
var idnull = stringIDToTypeID("null");
var ref2 = new ActionReference();
var idfilterFX = stringIDToTypeID("filterFX");
ref2.putIndex(idfilterFX, 1);
var idlayer = stringIDToTypeID("layer");
var idordinal = stringIDToTypeID("ordinal");
var idtargetEnum = stringIDToTypeID("targetEnum");
desc189.putReference(idnull, ref2);
var desc190 = new ActionDescriptor();
var idfilter = stringIDToTypeID("filter");
var desc191 = new ActionDescriptor();
var idAdobespCameraspRawspFilter = stringIDToTypeID("Adobe Camera Raw Filter");
desc189.putObject(idfilterFX, idfilterFX, desc190);
executeAction(idset, desc189, DialogModes.ALL);
} catch (error) {}
I prefer your code!
Copy link to clipboard
Copied
For what it is worth – while hacking away, I came up with the following 2 scripts which I may as well share just in case they are useful for somebody else...
/*
Add New Camera Raw Smart Filter with Dialog.jsx
by Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/edit-camera-raw-with-javascript/td-p/14072338
*/
try {
executeAction(stringIDToTypeID('Adobe Camera Raw Filter'), new ActionDescriptor(), DialogModes.ALL);
} catch (error) {}
And this one:
/*
Reset Camera Raw Smart Filter with Dialog.jsx
by Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/edit-camera-raw-with-javascript/td-p/14072338
*/
try {
var idset = stringIDToTypeID("set");
var desc189 = new ActionDescriptor();
var idnull = stringIDToTypeID("null");
var ref2 = new ActionReference();
var idfilterFX = stringIDToTypeID("filterFX");
ref2.putIndex(idfilterFX, 1);
var idlayer = stringIDToTypeID("layer");
var idordinal = stringIDToTypeID("ordinal");
var idtargetEnum = stringIDToTypeID("targetEnum");
desc189.putReference(idnull, ref2);
var desc190 = new ActionDescriptor();
var idfilter = stringIDToTypeID("filter");
var desc191 = new ActionDescriptor();
var idAdobespCameraspRawspFilter = stringIDToTypeID("Adobe Camera Raw Filter");
// Comment out the following line to open and retain the previous CRF settings
desc190.putObject(idfilter, idAdobespCameraspRawspFilter, desc191);
desc189.putObject(idfilterFX, idfilterFX, desc190);
executeAction(idset, desc189, DialogModes.ALL);
} catch (error) {}
Copy link to clipboard
Copied
It was helpful to me and Camera Raw is enabled by default in Photoshop, and it is easy to open. Simply go to the top menu and select Filter > Camera Raw Filter. This will open up the enabled Camera Raw Filter in Photoshop. Once you have done this, restart Photoshop and you will be able to access the Camera Raw filter from the Filter menu. Thankyou all
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more