Answered
Conditional Check for Camera Raw Doc, Saved Doc or Unsaved Doc
The background for this post started here:
I have a script working for Saved/Unsaved docs, but when it comes to an open doc rendered from a raw file via Adobe Camera Raw, I am having problems with adding a third condition and then having all three test documents successfully parsed.
I have gone "back to basics" many times, but keep hitting problems.
So before I even start comparing Saved (backing path exists) vs Unsaved (no backing path) vs Raw opened via ACR, I just wanted to first determine what is a rendered raw file.
This could be done via metadata, but isn't bulletproof as standard files can contain CRS metadata. So basing this test of filename seems to be better, but not bullet proof. Combining a conditional check for both filename extension and CRS metadata would be best.
So, my first hurdle is the following, compare the following simplified example, the second alert works as expected:
alert(activeDocument.name);
if (activeDocument.name.match(/\.(RAF|CR2|CR3|NRW|ERF|RW2|NEF|ARW|RWZ|EIP|DNG|BAY|DCR|RAW|CRW|3FR|K25|KC2|MEF|DNG|CS1|ORF|ARI|SR2|MOS|CR3|GPR|SRW|MFW|FFF|SRF|KDC|MRW|J6I|RWL|X3F|PEF|IIQ|CXI|NKSC|MDC)$/i)) {
alert("Camera Raw Base File...");
}
However, when I use .fullName instead of .name – the second alert fails.
alert(activeDocument.fullName);
if (activeDocument.fullName.match(/\.(RAF|CR2|CR3|NRW|ERF|RW2|NEF|ARW|RWZ|EIP|DNG|BAY|DCR|RAW|CRW|3FR|K25|KC2|MEF|DNG|CS1|ORF|ARI|SR2|MOS|CR3|GPR|SRW|MFW|FFF|SRF|KDC|MRW|J6I|RWL|X3F|PEF|IIQ|CXI|NKSC|MDC)$/i)) {
alert("Camera Raw Base File...");
}
Why? What am I missing? The regular expression match should work either way!
After answering this basic question, my next challenge is the conditional check for Saved, Unsaved and Raw file...

