Skip to main content
NexusFred
Inspiring
September 9, 2023
Answered

Edit Camera Raw with Javascript

  • September 9, 2023
  • 3 replies
  • 1083 views

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 );

 

This topic has been closed for replies.
Correct answer c.pfaffenbichler

@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 );

3 replies

Participant
September 13, 2023

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

Stephen Marsh
Community Expert
Community Expert
September 12, 2023

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.

NexusFred
NexusFredAuthor
Inspiring
September 12, 2023

That my problem too. I was hopping to find a way to add "CameraRAWSettingsType.SELECTEDIMAGE" into the script but I can't find how. 

Thanks :-)
c.pfaffenbichler
Community Expert
Community Expert
September 12, 2023
quote

 "CameraRAWSettingsType.SELECTEDIMAGE"

Where did you get that? 

c.pfaffenbichler
Community Expert
Community Expert
September 11, 2023

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? 

NexusFred
NexusFredAuthor
Inspiring
September 11, 2023

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

 

 

Thanks :-)
c.pfaffenbichler
Community Expert
Community Expert
September 12, 2023

Please provide meaningful screenshots

 

Does the Layer already have the Smart Filter applied at the beginning of the Action?