Page 1 of 1

Help required creating a Utility Script

PostPosted: Thu Dec 30, 2010 10:35 pm
by JohnKemp
Firstly I just want to say a big thank how great it is to finally have thumbnails for all my NEF and PSD files in Windows 7 !

The Codecs was my main reason for buying FPV Pro, but I am hoping the program will help speed up my initial culling of RAW files before moving on to Bibble which is my RAW convertor of choice.

One of the things I want to be able to do is set the XMP "Label" to red for all pictures above a certain ISO. This will make is easier for me to identify the images that need fine tuning with noise reduction in Bibble.

I'm hoping I can do this using a couple of Javascripts in the file utilities.

I have set up my first one line script to identify the images in question:

Code: Select all
function Evaluate(context)
    return context("Meta.ISOSpeed") >= 700 ? 1 : 0;

This works perfectly.

I hope was that my action script would then be as simple as:

Code: Select all
function Execute(context)
    context("Meta.XMP.Label")="1" ; /* Will not write back to the file! */
    return 0; // Tell execution was successful

Whilst this runs without syntax errors, it doesn’t appear to actually do anything !

If I place “wshShell.popup” functions before and after that line, and start off with an image with the label set to say green, I initially see Meta.XMP.Label is set to “3” as expected, and then changes to “1” as planned, however the change doesn’t then get written back to the XMP file.

I should say at this point that I know very little about Javascript !

Is there something extra I need to add to my one-line action script to ensure that Meta.XMP.Label updates the XMP file, or have I got completely the wrong end of the stick with my script ?

If there is an example of doing something like this either in the help or on this forum, I’m happy to be told to “RTFM”, but a pointer to where the info is would be much appreciated !

Thanks in advance for your help with this.

Best regards,


Re: Help required creating a Utility Script

PostPosted: Thu Dec 30, 2010 11:49 pm
by Axel
Thanks for the kind words and welcome to FPV Pro! You are digging into one of the most advanced feature of the program and your intuition is very good, unfortunately the metadata as presented in the File Utilities plug-in scripting environment will not be written back to the file.

The intent was to be able to take decisions based on variables (in your case the ISO value) and as you found out it is quite easy to create a condition trigger on such value, to select files.

The variables are also present on the "action" side where your custom script is supposed to act on the selected files, but only as a reference. The trigger condition can write to the context (e.g. modify existing variable or add new ones) as a mean to communicate to the action part of the rule, but changes are not written back to the file.

On the other hand, you just suggested 3 new "actions" for inclusion in a future version, namely "Set Rating", "Set Label" and "Set Urgency", that would allow for automating the metadata operations already present in the program.

For the time being, the workaround would be to use an external utility that would write the XMP Label in the current file.

You could for example launch the ExifTool utility by Phil Harvey (using the WhShell Run command), with a command line similar to:

Code: Select all
exiftool -xmp:Label=Red -overwrite_original "full_path_to_the_current_file"

The name of the file being processed is available in context("File.Name"), just remember to enclose it in double-quotes when building your command-line, as it may contain spaces. I suggest to set the bWaitOnReturn flag of the Run command to true, to avoid spawning too many instances of ExifTool (several can launch in parallel already, as the file utilities plug-in is multicore-aware and will process multiple files simultaneously on multiprocessor computers).

I recommend using "Red" as label instead of "1" for better compatibility with other XMP-aware applications. Red, Yellow, Green, Blue, Purple (for 1 to 5) is the convention used by default by Adobe Lightroom, for example. FPV will regognize Red or 1 equally well, on the other hand, and you may want to check what works best with Bibble Pro.

Using ExifTool also has some advantages as this utility supports writing medatada within raw files, while FPV Pro currently only writes to XMP sidecars for those image formats, as opposed to JPEG, HD Photo and TIFF where metadata embedding is supported.

I'd be very interested to hear about your results, please keep us posted!

Re: Help required creating a Utility Script

PostPosted: Fri Dec 31, 2010 11:34 pm
by JohnKemp

Thank you for your quick and clear reply.

It's a shame I can't immediately do what I want, but good to know that I was at least going in the right direction.

I will have a play with ExifTool and see how I get on - off hand do you know if it can write to the .XMP file ? As far as I'm concerned, the integrity of the original NEF file should be sacrosanct, so I don't want to be writing tags into it.

In the mean time, I can work around by firing up (Adobe) Bridge - that lets me quickly filter images based on ISO, hitting <CTRL> and 6 then labels them all as Red. Just a pain to have to use an extra program in the workflow.

From your point of view, would adding the three new actions you suggest be very complicated ? It would be the perfect solution for me, and would (IMO) give the file utilities a lot more power. Setting the labels and rating in this way could be very useful to people who are using FPV are a precursor to their main RAW conversion workflow.

Something of an unfair question, but do you think we are likely to see the actions being added to File Utilities in the short to medium term - say 6 to 9 months ?

Would it be helpful for me to post something in the "Suggestions" Forum ?

Thanks again for your reply. I will post back any success (or otherwise) I have with Exiftool.

Best regards,


Re: Help required creating a Utility Script

PostPosted: Sat Jan 01, 2011 8:12 am
by Axel
ExifTool will write the XMP data within the file themselves, so you may want to think twice as this will in effect modify the NEFs.

On the other hand, it should be possible to create/update XMP sidecars from the JavaScript action, using the MSXML2.DomDocument.6.0 ActiveX object, but this may require more work than it initally appears (to properly deal with XML namespaces and be able to update any existing XMP-compliant sidecars). Still doable, though!

As usual, release dates for specific features is a delicate subject, but 6-9 months seems like a looong time, it will probably take less than that to add "native" XMP writing functions to the File Utilities plug-in 8-)

Re: Help required creating a Utility Script

PostPosted: Sun Jan 09, 2011 12:54 am
by Axel
FastPictureViewer Professional v1.4 is now available, with a new "ISO Speed" trigger condition and new "set Rating/Label/Urgency" actions in the File Utilities plug-in. You should now be able to create your batch job rule in a couple of clicks.

Re: Help required creating a Utility Script

PostPosted: Sun Jan 09, 2011 9:50 pm
by JohnKemp
Flippin' heck Axel - That was stunningly quick !

I've been busy with work this last week and just haven’t had a chance to get back to this thread. I have been thinking I must get round to replying to your previous post but also that your suggestion sounded a bit complicated for my first toe in the water of Javascript, so this is a very welcome development!

It really is an exceptional level of support that you have been able to include this extra functionality into a live release so quickly.

I have downloaded V1.4 and will try out the new features later on this evening.

Hopefully others will find the ISO trigger and set rating/label/urgency options useful too.

Thank you once again.

Best regards,