PDA

View Full Version : Auto XMP file in folder (Grap this)


Benny Pedersen
August 23rd, 2006, 09:46 PM
This little program is figured out yesterday and updated today.

Let say that you have a folder with RAW files that you want
to be opened in PE but with the same WhiteBalance or whatever.
Drag and drop a RAW file onto this CMD file and the RAW file would be opened in PE as specified. The RAW file is not modified, so just read this code or/and experiment... :)

Benny

Open.CMD (Maybe under construction)
@echo off&color F0&setlocal enableextensions enabledelayedexpansion&rem DOS Batch file by Benny Pedersen
::
:: Drag and drop a RAW file "P\N.X" (path(P)\base(N).extension(X)).
:: To be sure the Camera RAW Database is not used, you could
:: either write protect, delete or rename the database.
:: One XMP template file is used "(P)\(N).xmp".
:: If the XMP file is not found, any first (random) found template XMP file
:: would be removed/taken in P, else used, otherwise created (read-only).
::
set p=C:\Program Files\Adobe\Photoshop Elements 4.0\Photoshop Elements 4.0.exe
if not exist "%p%" (
set p=%ProgramFiles%%p:~16%
if not exist "!p!" (
echo %p%&echo.
echo OOPS: PhotoshopE not found. You should modify "%~nx0", ^(Line numb 10^)
echo -----&echo QUIT:&pause&goto:end
))
if not exist "%~dpnx1" (
echo.&echo OOPS: You forgot to Drag ^& Drop a RAW file :-^)
echo -----&echo QUIT:&pause&goto:end
)
if exist "%~dpn1.xmp" goto:p
(set CtrlStrng=Benny Pedersen. http://hjem.get2net.dk/b_pedersen/gallery)
for /r "%~dp1" %%f in (*.xmp) do (
call:IsTemplateXMP " %CtrlStrng% " "%%~ff"
if defined IsTemplateXMP move "%%~ff" "%~dpn1.xmp"
if exist "%~dpn1.xmp" goto:p
)
:db
cls&echo.&set crdP=%appdata%\Adobe\CameraRaw
if exist "%crdP%\Database" (
echo. What to do with Adobe
echo. Camera RAW Database ?
echo.&echo. 1. Write Protect
echo.&echo. 2. - Unprotect
echo.&echo. 3. Delete
echo.&echo. 4. Open folder
echo.&echo. 5. Nothing
echo.&set /p answer= Input a number: % %
if "!answer!" == "1" attrib +r "%crdP%\Database"&goto:db_out
if "!answer!" == "2" attrib -r "%crdP%\Database"&goto:db_out
if "!answer!" == "3" echo.&del /p "%crdP%\Database"&goto:db
if "!answer!" == "4" explorer "%crdP%"&echo.&echo Activate this window, then:&pause&goto:db
if not "!answer!" == "5" goto:db
)
:db_out
echo ^<^^!-- %CtrlStrng% --^>> "%~dpn1.xmp"
findstr /B "<rdf <crs </rdf <^!" %~sf0 >> "%~dpn1.xmp"
attrib +r "%~dpn1.xmp"
:p
"%p%" "%~dpnx1"
goto:end
:IsTemplateXMP
(set IsTemplateXMP=)
for /f "usebackq tokens=1 delims=<!--" %%f in (%2) do (
if %1 == "%%f" (set IsTemplateXMP=1)
goto:eof
)
goto:eof
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/">
<!-- WhiteBalance As Shot -->
<!-- Auto -->
<!-- Tungsten (2850 0) -->
<!-- Fluorescent (3800 +21) -->
<!-- Flash (5500 0) -->
<!-- Daylight (5500 +10) -->
<!-- Cloudy (6500 +10) -->
<!-- Shade (7500 +10) -->
<!-- Custom -->
<crs:WhiteBalance>As Shot</crs:WhiteBalance>

<!-- Temperature 2000 ... 50000 and WhiteBalance Custom -->
<crs:Temperature>6050</crs:Temperature>

<!-- Tint -150 ... +150 and WhiteBalance Custom -->
<crs:Tint>+5</crs:Tint>

<!-- Exposure -4.00 ... +4.00 and AutoExposure False -->
<crs:Exposure>-0.50</crs:Exposure>
<crs:AutoExposure>False</crs:AutoExposure>

<!-- Shadows 0 ... 100 and AutoShadows False -->
<crs:Shadows>3</crs:Shadows>
<crs:AutoShadows>False</crs:AutoShadows>

<!-- Brightness 0 ... 150 and AutoBrightness False -->
<crs:Brightness>32</crs:Brightness>
<crs:AutoBrightness>False</crs:AutoBrightness>

<!-- Contrast -50 ... +100 and AutoContrast False -->
<crs:Contrast>+22</crs:Contrast>
<crs:AutoContrast>True</crs:AutoContrast>

<!-- Saturation -100 ... +100 -->
<crs:Saturation>0</crs:Saturation>

<!-- Sharpness 0 ... 100 -->
<crs:Sharpness>26</crs:Sharpness>
<crs:LuminanceSmoothing>0</crs:LuminanceSmoothing>
<crs:ColorNoiseReduction>0</crs:ColorNoiseReduction>
</rdf:Description></rdf:RDF>
:end
endlocal

Benny Pedersen
August 26th, 2006, 06:29 PM
(Note *) Under special circumstances, result is not as expected.
To avoid that, a brief explanation is relevant whether you are using my CMD file or not.

(Note **, Alternative) To keep and use an XMP template to store data for each RAW file, instead of using the database, simply delete one line from CMD code: attrib +r "%~dpn1.xmp"

Photoshop Elements is using a Camera RAW Database. When you open a RAW file, Adobe read/write your settings for each picture. Ex. If a person opened a RAW file 40 days ago in Photoshop and then you open the same file today, the settings that someone used 40 days ago maybe present.
Another way is using an XMP (sidecar) file. A problem is this:
If the XMP file is older than the database access date, Adobe seems to ignore your XMP file.
Such circumstances come up particularly while testing my CMD file but less problems in normal work.

To eliminate confusing/circumstances (until I update the CMD code), you could first delete or remove any XMP files in the folder where your going to work. (see note *)

So, what is normal work, purpose and use of the CMD file.
Answer:

Here the same XMP template is used for each/any RAW file.
- the XMP template is NOT used to store information, but is only
used to instruct Photoshop about settings. (see note **)

---
1: Drag and drop a RAW file onto the CMD shortcut.

What to do with Camera RAW Database ?
1. Write Protect
2. - Unprotect
3. Delete
4. Open folder
5. Nothing

*** Say 1 to avoid settings to be stored in database (see note **)
*** Say 3 to create a new database.
*** Say 5 to ignore.

Photoshop would open the RAW file, using your settings in the
write protected XMP template...

Benny.

GaryK
August 26th, 2006, 06:41 PM
Benny

Thanks for the info.. and the program... it all seems a bit beyond my understanding. But then I rarely shoot in RAW. (I know.. I should :D)

You must have spent a lot of time figuring this out.:)

Benny Pedersen
August 26th, 2006, 07:27 PM
Benny

Thanks for the info.. and the program... it all seems a bit beyond my understanding. But then I rarely shoot in RAW. (I know.. I should :D)

You must have spent a lot of time figuring this out.:)

Yes :). From the day I discovered and saw an XMP file (never saw or heard about XMP) and until my description, 2 days.
BTW: The CMD code is for WinXP but since I used a lot of DOS in the old days (some university around still using my old work). Hmmm, I even got a project named benny:
http://www.google.dk/search?hl=da&q=bennylevel&meta=
So, the DOS (different today) but was not the problem. Since I learned myself, it was hard work (I did not get an education except normal school).

Benny

GaryK
August 26th, 2006, 07:35 PM
Benny

I dabbled with programming years ago, ZAP and FORTRAN, then tried BASIC. I really enjoyed it, but life took me other places.

So what is an XMP file? Kind of like a BAT file, or more of a language?

Benny Pedersen
August 29th, 2006, 03:28 PM
Benny

I dabbled with programming years ago, ZAP and FORTRAN, then tried BASIC. I really enjoyed it, but life took me other places.

So what is an XMP file? Kind of like a BAT file, or more of a language?

An XMP file is data about data.

Google search: http://www.google.dk/search?q=xmp+sidecar+adobe&hl=da&lr=&start=10&sa=N

Benny :D