Copy link to clipboard
Copied
I write some code to execute the auto tone of camera raw , but the image has no effects. I konw the Action Manager can't record the auto tone of camera raw,so i add the follow code :
desc1.putBoolean(charIDToTypeID('Auto'), true);
and the auto function is still not work.Any help will be appreciated!
All code is as follows:
(function () {
// Camera Raw Filter
var desc1 = new ActionDescriptor();
desc1.putString(charIDToTypeID('CMod'), "Filter");
desc1.putEnumerated(charIDToTypeID('Sett'), charIDToTypeID('Sett'), charIDToTypeID('Cst '));
desc1.putEnumerated(charIDToTypeID('WBal'), charIDToTypeID('WBal'), charIDToTypeID('AsSh'));
desc1.putBoolean(charIDToTypeID('Auto'), true);
desc1.putInteger(charIDToTypeID('Temp'), 0);
desc1.putInteger(charIDToTypeID('Tint'), 0);
desc1.putBoolean(charIDToTypeID('CtoG'), false);
desc1.putInteger(charIDToTypeID('Strt'), 0);
desc1.putInteger(charIDToTypeID('Shrp'), 0);
desc1.putInteger(charIDToTypeID('LNR '), 0);
desc1.putInteger(charIDToTypeID('CNR '), 0);
desc1.putInteger(charIDToTypeID('VigA'), 0);
desc1.putInteger(charIDToTypeID('BlkB'), 0);
desc1.putInteger(charIDToTypeID('RHue'), 0);
desc1.putInteger(charIDToTypeID('RSat'), 0);
desc1.putInteger(charIDToTypeID('GHue'), 0);
desc1.putInteger(charIDToTypeID('GSat'), 0);
desc1.putInteger(charIDToTypeID('BHue'), 0);
desc1.putInteger(charIDToTypeID('BSat'), 0);
desc1.putInteger(charIDToTypeID('Vibr'), 0);
desc1.putInteger(charIDToTypeID('HA_R'), 0);
desc1.putInteger(charIDToTypeID('HA_O'), 0);
desc1.putInteger(charIDToTypeID('HA_Y'), 0);
desc1.putInteger(charIDToTypeID('HA_G'), 0);
desc1.putInteger(charIDToTypeID('HA_A'), 0);
desc1.putInteger(charIDToTypeID('HA_B'), 0);
desc1.putInteger(charIDToTypeID('HA_P'), 0);
desc1.putInteger(charIDToTypeID('HA_M'), 0);
desc1.putInteger(charIDToTypeID('SA_R'), 0);
desc1.putInteger(charIDToTypeID('SA_O'), 0);
desc1.putInteger(charIDToTypeID('SA_Y'), 0);
desc1.putInteger(charIDToTypeID('SA_G'), 0);
desc1.putInteger(charIDToTypeID('SA_A'), 0);
desc1.putInteger(charIDToTypeID('SA_B'), 0);
desc1.putInteger(charIDToTypeID('SA_P'), 0);
desc1.putInteger(charIDToTypeID('SA_M'), 0);
desc1.putInteger(charIDToTypeID('LA_R'), 0);
desc1.putInteger(charIDToTypeID('LA_O'), 0);
desc1.putInteger(charIDToTypeID('LA_Y'), 0);
desc1.putInteger(charIDToTypeID('LA_G'), 0);
desc1.putInteger(charIDToTypeID('LA_A'), 0);
desc1.putInteger(charIDToTypeID('LA_B'), 0);
desc1.putInteger(charIDToTypeID('LA_P'), 0);
desc1.putInteger(charIDToTypeID('LA_M'), 0);
desc1.putInteger(charIDToTypeID('STSH'), 0);
desc1.putInteger(charIDToTypeID('STSS'), 0);
desc1.putInteger(charIDToTypeID('STHH'), 0);
desc1.putInteger(charIDToTypeID('STHS'), 0);
desc1.putInteger(charIDToTypeID('STB '), 0);
desc1.putInteger(charIDToTypeID('PC_S'), 0);
desc1.putInteger(charIDToTypeID('PC_D'), 0);
desc1.putInteger(charIDToTypeID('PC_L'), 0);
desc1.putInteger(charIDToTypeID('PC_H'), 0);
desc1.putInteger(charIDToTypeID('PC_1'), 25);
desc1.putInteger(charIDToTypeID('PC_2'), 50);
desc1.putInteger(charIDToTypeID('PC_3'), 75);
desc1.putDouble(charIDToTypeID('ShpR'), 1);
desc1.putInteger(charIDToTypeID('ShpD'), 25);
desc1.putInteger(charIDToTypeID('ShpM'), 0);
desc1.putInteger(charIDToTypeID('PCVA'), 0);
desc1.putInteger(charIDToTypeID('GRNA'), 0);
desc1.putInteger(charIDToTypeID('LPEn'), 0);
desc1.putInteger(charIDToTypeID('MDis'), 0);
desc1.putInteger(charIDToTypeID('PerV'), 0);
desc1.putInteger(charIDToTypeID('PerH'), 0);
desc1.putDouble(charIDToTypeID('PerR'), 0);
desc1.putInteger(charIDToTypeID('PerS'), 100);
desc1.putInteger(charIDToTypeID('PerA'), 0);
desc1.putInteger(charIDToTypeID('PerU'), 0);
desc1.putDouble(charIDToTypeID('PerX'), 0);
desc1.putDouble(charIDToTypeID('PerY'), 0);
desc1.putInteger(charIDToTypeID('AuCA'), 0);
desc1.putDouble(charIDToTypeID('Ex12'), 0);
desc1.putInteger(charIDToTypeID('Cr12'), 0);
desc1.putInteger(charIDToTypeID('Hi12'), 0);
desc1.putInteger(charIDToTypeID('Sh12'), 0);
desc1.putInteger(charIDToTypeID('Wh12'), 0);
desc1.putInteger(charIDToTypeID('Bk12'), 0);
desc1.putInteger(charIDToTypeID('Cl12'), 0);
desc1.putInteger(charIDToTypeID('DfPA'), 0);
desc1.putInteger(charIDToTypeID('DPHL'), 30);
desc1.putInteger(charIDToTypeID('DPHH'), 70);
desc1.putInteger(charIDToTypeID('DfGA'), 0);
desc1.putInteger(charIDToTypeID('DPGL'), 40);
desc1.putInteger(charIDToTypeID('DPGH'), 60);
desc1.putInteger(charIDToTypeID('Dhze'), 0);
desc1.putInteger(charIDToTypeID('TMMs'), 0);
var list1 = new ActionList();
list1.putInteger(0);
list1.putInteger(0);
list1.putInteger(255);
list1.putInteger(255);
desc1.putList(charIDToTypeID('Crv '), list1);
var list2 = new ActionList();
list2.putInteger(0);
list2.putInteger(0);
list2.putInteger(255);
list2.putInteger(255);
desc1.putList(charIDToTypeID('CrvR'), list2);
var list3 = new ActionList();
list3.putInteger(0);
list3.putInteger(0);
list3.putInteger(255);
list3.putInteger(255);
desc1.putList(charIDToTypeID('CrvG'), list3);
var list4 = new ActionList();
list4.putInteger(0);
list4.putInteger(0);
list4.putInteger(255);
list4.putInteger(255);
desc1.putList(charIDToTypeID('CrvB'), list4);
desc1.putString(charIDToTypeID('CamP'), "Embedded");
desc1.putString(charIDToTypeID('CP_D'), "54650A341B5B5CCAE8442D0B43A92BCE");
desc1.putInteger(charIDToTypeID('PrVe'), 167772160);
desc1.putString(charIDToTypeID('Rtch'), "");
desc1.putString(charIDToTypeID('REye'), "");
desc1.putString(charIDToTypeID('LCs '), "");
desc1.putString(charIDToTypeID('Upri'), "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21 \">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <rdf:Description rdf:about=\"\"\n xmlns:crs=\"http://ns.adobe.com/camera-raw-settings/1.0/\"\n crs:UprightVersion=\"151388160\"\n crs:UprightCenterMode=\"0\"\n crs:UprightCenterNormX=\"0.5\"\n crs:UprightCenterNormY=\"0.5\"\n crs:UprightFocalMode=\"0\"\n crs:UprightFocalLength35mm=\"35\"\n crs:UprightPreview=\"False\"\n crs:UprightTransformCount=\"6\"/>\n </rdf:RDF>\n</x:xmpmeta>\n");
desc1.putString(charIDToTypeID('GuUr'), "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21 \">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <rdf:Description rdf:about=\"\"\n xmlns:crs=\"http://ns.adobe.com/camera-raw-settings/1.0/\"\n crs:UprightFourSegmentsCount=\"0\"/>\n </rdf:RDF>\n</x:xmpmeta>\n");
desc1.putString(charIDToTypeID('Look'), "");
desc1.putString(charIDToTypeID('Pset'), "");
executeAction(stringIDToTypeID('Adobe Camera Raw Filter'), desc1, DialogModes.NO);
})();
Copy link to clipboard
Copied
Try
desc1.putBoolean(charIDToTypeID("AuTn"), true);
Copy link to clipboard
Copied
Thank you very much. You are right.
Copy link to clipboard
Copied
Hi zero3s,
Could you share the JSX for me?
When I copy your script and use it with Photoshop 2020/ACR 12.2 it does nothing? It runs the script, but there are no changes.
I did try to add and replace: desc1.putBoolean(charIDToTypeID('Auto'), true); with desc1.putBoolean(charIDToTypeID("AuTn"), true); in your script. But it didn't solve it.
Copy link to clipboard
Copied
Try this for a more concise block of code that only does one thing in the Camera Raw Filter (not to be confused with ACR, Adobe Camera Raw):
(function () {
// Camera Raw Filter - Auto
var desc1 = new ActionDescriptor();
desc1.putBoolean(charIDToTypeID("AuTn"), true); // AuTn = Auto
executeAction(stringIDToTypeID('Adobe Camera Raw Filter'), desc1, DialogModes.NO);
})();
or:
autoCRF();
function autoCRF() {
// Camera Raw Filter - Auto
var desc1 = new ActionDescriptor();
desc1.putBoolean(charIDToTypeID("AuTn"), true); // AuTn = Auto
executeAction(stringIDToTypeID('Adobe Camera Raw Filter'), desc1, DialogModes.NO);
}
P.S. ACR and raw files would be covered by this topic post:
https://community.adobe.com/t5/photoshop/how-to-record-button-click-on-action/td-p/10858184
Copy link to clipboard
Copied
While I am about it, here is an example of a setting with a parameter/value:
exposureCRF(expValue = 1.000000); // +1
function exposureCRF() {
// Camera Raw Filter - Exposure
var desc1 = new ActionDescriptor();
desc1.putDouble(charIDToTypeID('Ex12'), expValue); // Variable
executeAction(stringIDToTypeID('Adobe Camera Raw Filter'), desc1, DialogModes.NO);
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
No worries, happy to make a minor contribution based on the work of zero3s and r-bin!
P.S. Just keep in mind that this is for rendered images using the Camera Raw Filter, which is not the same thing as a raw camera image file processed via Adobe Camera Raw.
Copy link to clipboard
Copied
I'll understand...
The script is used to automate the following steps: Open TIFF - Filter - Camera Raw Filter - Auto -Ok
Last question: What's the difference between the 2 scripts you posted?
Thanks again
Copy link to clipboard
Copied
try {
var d = new ActionDescriptor();
d.putBoolean(stringIDToTypeID("dontRecord"), false);
d.putBoolean(stringIDToTypeID("forceNotify"), true);
d.putPath(stringIDToTypeID("null"), new File("/c/000/DSC_3030.NEF")); // your raw file
var d1 = new ActionDescriptor();
d1.putBoolean(charIDToTypeID("AuTn"), true);
d1.putEnumerated(stringIDToTypeID("colorSpace"), stringIDToTypeID("colorSpace"), stringIDToTypeID("sRGB"));
d1.putEnumerated(stringIDToTypeID("bitDepth"), stringIDToTypeID("bitDepth"), stringIDToTypeID("bitDepth8"));
d1.putDouble(stringIDToTypeID("resolution"), 300);
d.putObject(stringIDToTypeID("as"), stringIDToTypeID("Adobe Camera Raw"), d1);
d.putDouble(stringIDToTypeID("overrideOpen"), true);
d.putBoolean(stringIDToTypeID("smartObject"), true);
executeAction(stringIDToTypeID("open"), d, DialogModes.ALL); // ALL - for dialog to control, NO - silent
}
catch (e) { throw(e); }
Copy link to clipboard
Copied
"Last question: What's the difference between the 2 scripts you posted?"
The first script is a "self-invoking" function, it does not need to be called, it executes when parsed by the JS interpreter.
The second script is a "declared" function, it has to be "called" or executed using the declared function name.
As a beginner, I am just starting to learn through trial and error some of the basics when it comes to functions!
Copy link to clipboard
Copied
Is it possible to get the values from the camera raw filter if you have applied it to a smartobject?
Copy link to clipboard
Copied
wow this works. would you happen to know what the variable would be to execute Geometry > apply level correction?
Copy link to clipboard
Copied
r-bin probably does, I just inserted the code into a concise stand-alone script rather than the more verbose script originally posted.
Copy link to clipboard
Copied
Took me lots of digging to find this. Here you go.
/*
Camera Raw Filter - Transform Values:
1 = Auto, 2 = Full, 3 = Level, 4 = Vertical
*/
transformCRF( transValue = 1 );
function transformCRF() {
var actDesc = new ActionDescriptor();
var transCode = charIDToTypeID("PerU");
actDesc.putInteger(transCode, transValue);
executeAction(stringIDToTypeID("Adobe Camera Raw Filter"), actDesc, DialogModes.NO);
}