Script for Camera Raw Catch

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

jtredinn

Script for Camera Raw Catch

Post by jtredinn »

Hi all,
I'm trying to figure out a way to incorporate my script for opening files in Photoshop to catch if no Camera Raw settings have been done to the file yet. Currently, I open files using a droplet that applies my actions and preferences to the files so when I start working all of my layers and adjustments have been added. The problem I run into is that sometimes files that haven't had Camera Raw adjustments made sneak into my workflow. I want to create a script that catches this, gives me an alert that files haven't had their color adjustments yet/haven't been run through Camera Raw. I've done a lot of reading forums, but most out there is to pull the data for creating files, or to enter the data, none for camera raw data directly.

I've tried a normal try { app.activeDocument.xmpMetadata.rawData.match(/<crs:HasSettings>/)[1] with a catch error, but I think this isn't the correct call out for catching the issue as it doesn't catch whether or not the crs data is there.

Any feedback is welcome! Thanks!
pedromarques

Script for Camera Raw Catch

Post by pedromarques »

This avoids error if rawData xml doesn't have that property

Code: Select allvar docHasSettings = "";
var raw = app.activeDocument.xmpMetadata.rawData;
// Test first and if exists then get it (avoiding eventual error) 
if (String(raw).match(/\<crs:HasSettings\>(.+)\<\/crs:HasSettings\>/) != null) docHasSettings = String(raw).match(/\<crs:HasSettings\>(.+)\<\/crs:HasSettings\>/)[1];