Filetags - file tagger and metadata viewer

Background:

This project was inspired by @Steve's excellent Photo Exif script which was inspired in turn by @auden's metadata entry system. I added support for tagging and button driven next/previous navigation plus the ability to monitor changes to the source folder using Dialog.Watchtab. As the script developed it struck me that tagging and rating can be applied to any file so it has morphed into a general purpose file tagger with additional information provided if the file is an image. The UI is heavily based on @Steve's layout with several added bells and whistles.

Features:

  • Sequentially displays information about selected files, or all files in the current folder.
  • Information varies according to the current file type - e.g. image, movie, program, document.
  • Most files can be previewed in an appropriate form by clicking on the associated thumbnail.
  • Star ratings, tags and some file attributes are editable for all file types.
  • In addition, description and copyright are editable for images.
  • The current file can be renamed from the dialog.
  • Programs, documents and PDFs can be launched via a button.
  • Up to three image processing applications can be configured - e.g. Photoshop, Snagit, Irfanview, etc.
  • Up to three editors can be configured - e.g. Notepad++, Frhed, UltraEdit.
  • The current file can be added to a nominated collection.

Persistent Dialog:

  • Folders and tabs are tracked by the dialog as the user navigates.
  • Next and Previous buttons provide easy navigation.
  • The dialog is refreshed when file selections are changed by the user in the associated tab.

Installation:

filetags 1_2.js.txt (49.2 KB)

  1. Download: filetags 1_2.js.txt - requires at least DOpus 12.21.5 Beta.
  2. Copy to Script Addins (just type /scripts into the address bar) to locate.

Usage:

filetags.dcf (727 Bytes)

  1. Download filetags.dcf
  2. Select "Settings/Customize Toolbar..." and drag the .dcf button file to any toolbar.
  3. The left mouse button will execute with no debugging and the right mouse button will execute with maximum debugging.
  4. Debugging information is written to the "Other" log.

Config:

A number of options are available in the normal Script AddIn configuration editor.

History:

1.0 (12th November 2020) Initial Release

1.1 (23rd November 2020)

  • Fix problem with DOpus.Loadimage with invalid image files
  • Add support for the Esc key as a means of exiting the dialog
  • Handle undefined focal length

1.2 (24th November 2020)

  • Improve handling of invalid images
  • Allow tagging and rating and attribute setting on all existing non-archive files
  • Add support for Ctrl+0 through Ctrl+5 for setting star ratings
  • Add support for Ctrl+P (configurable) to access script preferences
  • Make Esc to exit dialog optional (default = true)
6 Likes

@aussieboykie
Large oaks from little acorns grow ...

Very nice idea :smile:

1 Like

Wanted to try this out, but after browsing through appr. 16 images the dialog disappears and the log shows

Error at line 636, position 3
Invalid procedure call or argument (0x800a0005)

Made 2-3 attempts, error seems reproducible.

The DOpus.Loadimage statement at line 636 looks innocuous but evidently something about the particular "currFile" is causing it to choke.

Is there anything unusual about the file that triggers the exception? If your run filetags dbg=6 the error log should identify the file immediately before executing the processFilePreview function which is where the problem occurs. The relevant section of the log will look something like..

 19/11/20 08:35 filetags:  [6] refreshDlg
 19/11/20 08:35 filetags:  [3] currfile = C:\Users\aussi\Downloads\846455-60x60.jpg
 19/11/20 08:35 filetags:  [6] processFilePreview

Knowing your skill level with Javascript, please feel free to dig around in the code.

something about the particular "currFile" is causing it to choke.

Yes. I used the sript on my image test folder that contains a garden variety of images. And I had forgotten it also contains some erroneous image files. These would reliably kill the dialog, resp. cause DOpus.Loadimage to fail.

I'd say it is Loadimage's responsibility to not crash when fed something inappropriate. Nonetheless an early check in the script if item.metadata is image might be a good idea.


Quick other feedback before I go back to trying out the script's core functionality:

  • Nice debugging info system!
  • Can Esc be added as a means to close the dialog?

It's not really crashing, just throwing an exception which the script doesn't handle. Adding try/catch around it should work.

However, handling exceptions in scripts is a pain in JScript and basically impossible in VBScript, so we'll change this in the next update to make life easier for scripters. In 12.22.3, LoadImage will return nothing/null/empty (VT_EMPTY) if the image doesn't exit or fails to load, and exceptions will only be thrown for things like missing arguments.

(We did a similar change for another method a little while ago. If there are other script methods that do this, let us know and we can change them. While it's not wrong for them to throw exceptions, it's not ideal either, outside of things like syntax errors or the wrong number of arguments. It's easy for us to overlook because the ActiveScripting languages are unusual in that they turn errors into exceptions automatically. In the case of LoadImage, we've changed it to say "I succeeded, and the result is empty" instead of "I failed" when it can't load the image. That's counterintuitive on our side, but a lot easier on the scripting side, which is what matters the most.)

2 Likes

v1.1 is now available in the head post and should address this problem. It also adds support for Escape as a means of exiting the dialog.

This is an awesome tool! Including status icons would make this even better...

Great work @aussieboykie!

Not sure what you mean @Chuck.

@aussieboykie

This is the method I use to display Labels in my metadata entry form.

I find it very useful to Label my files as they move through my production system.

e.g. When I change the resolution of my files for archiving and storage add a "240 res" Label

When I colour correct the image I add another label etc etc

It is very useful to see just which image is where in the production system and to script to prevent images from being moved around that system if it (for instance) is not of the right resolution.

I have been using it very successfully for years, and it is a real time saver.

I could find no way to put a graphical representation of the labels attached to an image in my entry form until I hit on the idea to have script identify just which labels are on the image.

Then I made a series of png representations of the labels, and displayed them in the form (as you can see in the picture)

I offer idea for what it is worth

@aussieboykie - I use DOpus labeling via status icons in my workflow, mostly for non-image files:

Used in conjunction with a Status column, I can quickly sort and identify files by visual queue (the status icon) for prioritization and action.

For me, this would add value in a new way to your already excellent tool!

Hope this clarifies...

Cheers!

@auden and @Chuck The Item object provides a means of determining what label/status assignments apply to a file. When time permits I will look into the possibility of adding this information to the dialog in some form. It would be nice if there was a way of retrieving the associated icon to use as a visual cue but I don't think there currently is.

image

@Chuck As a workaround you could filter the underlying tab to show only items with status, or select only items with status.

Head post updated to v1.2. Minor changes as follows:

1.2 (24th November 2020)

  • Improve handling of invalid images
  • Allow tagging and rating and attribute setting on all existing non-archive files
  • Add optional support for Ctrl+0 through Ctrl+5 for setting star ratings
  • Add support for Ctrl+P (configurable) to access script preferences
  • Make Esc to exit dialog optional (default = true)

@aussieboykie Thanks for the advice and the update. One thing I immediately noticed with the update is that the user has to reload configuration edits. Is there a way to save edits so when new script updates appear users do not have to go through the edit configuration process again?

Its because the version number is in the filename for the script. Opus will see each update as a new script (I had the same issue with one of my scripts). Easy fixed, just make sure the script and any updates to it have the same filename.

@aussieboykie

I tried every which way but loose to incorporate the icons in my script, but I could find no way other than making separate jpg representations of them all and calling hem into the script.

I find it so handy to know where in individual image is in my work flow.

One think I did not try was the icons as png files. That may have some possibilities in using the png files in the labels and the script.