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.
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..
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:
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.)
@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.
@Chuck As a workaround you could filter the underlying tab to show only items with status, or select only items with status.
@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.
I am not sure if this is the correct place to ask for this...
I am a beginner, and I found the tagger an excellent tool but got stuck in simple things, I couldn't find how to activate the "Script AddIn configuration editor". Then I couldn't find how to add metadata to folders themselves, very important for me because I use that to label similar work in different projects. And, I didn't know where are the tags stored, because it would be very useful to sort by tags, to classify all my work in different projects and group domains as defined by my tags. I hope you can give me a hand with this.
The current filetags implementation only tracks files, not folders but you can use Opus built-in functionality to edit tags on any file or folder. By default F9 is set to execute Set METAPANE=Toggle which opens a panel in which you can add/edit tags.
My understanding is that some tags are stored in the files themselves (e.g. for images) and others in ADS. Opus can access both types but most other applications can only access the former. You can add a tags column as shown below and then sort accordingly. You can also filter on tags. Step 1 in the following screen grab is to right mouse click on the column header bar.