Tagger

This script is inspired by this thread by abr: SetAttr META tags: pasted tags cut off
A german version is available at the H&P Community Forum: Tagger - Dateien und Ordner komfortabel taggen

For Directory Opus 12.2.3 and above I recommend to use the newer version 3.0 which provides a better dialog, much more features and doesn't need autohotkey.exe.

With the new version 2.0 Tagger is no longer a simple script-function button!
It's a Script Add-In now that implements the new command Tagger.
Version 2.1 no longer requires a separate AHK-Script. You can safely delete the file AutoMoveTagger.ahk if you used an older version before.

Installation:

  • The script requires the standalone tool Autohotkey.exe to move the dialog box out of the way. The tool can be downloaded here: [url]http://ahkscript.org/download[/url] (1,24 MB). Download the appropriate version for your system and copy it to any location.
  • Download the file Command.File_Tagger.vbs and copy it to /dopusdata/Script AddIns or drag it into the settings window Settings => Preferences => Toolbar => Scripts

Script Configuration:

  • Go to Settings => Preferences => Toolbar => Scripts. Select the entry command.file: Tagger and click Configure.
  • AHKexePath: Enter the full path to AutoHotkey.exe.
  • Filter: Enter a list of file extensions you want to edit with Tagger. All files with extensions not listed here will be hidden from the active tab until you close Tagger. Leave the list empty if you want to be able to edit all file types (default). The extensions must be listed without the dot and separated by a vertical line. Example: jpg|png|docx|pdf
  • Position: Adjust the position of the dialog on the screen in pixels: width, height. 0,0 is the top left corner of the screen. Tip: If the dialog is positioned at the top of the screen, the title bar can be hidden by setting the second value to "minus [height of the title bar]" (e.g. 0,-22).
  • TagFolders: Decide if you want to be able to apply tags to folders (True) or not (False). Folders will be hidden from the active tab if this was set to False.

Create and configure a button or hotkey:

  • Create a button or hotkey with the command Tagger.

Function:
Activating the button or hotkey opens a dialog box to edit tags. Beginning with the first selected item you can edit the tags of the file or folder. The dialog shows the index of the file/folder, the file name and the existing Tags of the file in alphabetic sort order. The "+" is inserted by default to add tags but you can also remove (-) or replace () tags. Multiple Tags can be applied by separating them with ";" (semi-colon). Clicking Ok (or one of the Tag button options) without changing anything will skip the current file.
The next item is automatically selected in an endless loop until you hit Cancel. This way you can preview and tag each item in a folder comfortably. The text field is limited to insert up to 512 characters.

Button Options:

  • Go Back: Select the previous item instead of the next item after applying tags to the currently selected file.
  • Tag Selected: Tags the items that has been selected at the beginning. The first selected item will be selected afterwards.
  • Tag Range: A dialog box will pop up in which you can define a Range of items to which you want to apply tags. The first item of the Range will be selected afterwards.
  • Tag All: Tags all items in the current folder. The first item will be selected afterwards.
  • Clear: Clears all Tags from the currently selected item.
  • Clear Selected: Clears all Tags from the items that has been selected at the beginning. The first selected item will be selected afterwards.
  • Clear Range: A dialog box will pop up in which you can define a Range of items for which you want to clear tags. The first item of the Range will be selected afterwards.
  • Clear All: Clears all Tags from all items in the current folder. Afterwards the first item will be selected.
The Range dialog box will not be moved by AutoHotkey. To make use of the Range option you need to know the index of the items. The index of the actual item is shown in the dialog box. To get the index of the other items you should turn on the column index. Note that you always have to count folders even if TagFolders was set to False.

Usage:
Tagger is especially useful to, for example, apply Tags to every single image in a huge image collection while viewing them in the preview panel. However, you can apply Tags to all file types and optionally to folders.
If you want to use the standalone viewer in fullscreen-mode to tag your files, you should have a look at my new script FullScreenMetaEdit with which you can also edit Ratings and User Descriptions of files but not edit several files at once or apply tags to folders.

Command.File_Tagger.vbs.txt (29.5 KB)

Update history:

Update 05.04.2014:

  • Removed the Stop button because it's not needed. Clicking OK without changing anything (text field contains only "+" or is empty) will skip the current file. Cancel finishes the loop.

Update12.04.2014:
Added new Options which can be chosen from the Buttons of the dialog:

  • Clear All: Clears all Tags from all files in the current tab. Afterwards the first file will be selected.
  • Tag All: Tags all files in the current tab. The first file will be selected afterwards.
  • Clear initially Selected: Clears all Tags from the files that has been selected at the beginning. The first selected file will be selected afterwards.
  • Tag initially Selected: Tags the files that has been selected at the beginning. The first selected file will be selected afterwards.

Update 13.04.2014:
Updated the first post and added the following changes:

  • Tag Selected is now the topmost option in the Tag button as suggested by abr.
  • Changed the button and option labels to make them shorter and added an info to the dialog message instead.
  • Added options to select a Range of files to the Clear and Tag buttons. After applying these options the first file of the range will be selected. To use the range options you should turn on the column index if your files are not numbered.

Update 18.04.2014:

  • Added a new button Go Back to navigate to the previous file instead of the next file.
  • Changed the behaviour of the Go Back button. Clicking the button now applies changes to the currently selected file before selecting the previous file instead of doing nothing with the current file. I think this makes more sense because you can apply tags going backwards now.

Bug Fix 19.04.2014:

  • The Clear Range and Tag Range options didn't work correctly because the selection wasn't cleared before adding new items to the selection.

Update 02.08.2014:

  • It's now possible to add tags to folders.

Update 04.11.2014 to version 2.0 :

  • Tagger is no longer a simple script-function button. It's a script Add-In now that implements the new command Tagger.
  • The paths to Autohotkey.exe and AutoMoveTagger.ahk can be configured in the script configuration.
  • Tagging of folders can be switched On/Off in the script configuration. If TagFolders was set to False, folders will be hidden from the active tab until you exit Tagger.
  • A file filter can be defined in the script configuration. Files with extensions not listed here will be hidden in the active tab. Leave the list empty to show all file types (default). Example: jpg|png|docx

Update 28.11.2014 to version 2.1:

  • The script no longer requires a separate AHK-Script. Tagger now creates the file AutoMoveTagger.ahk as a temporary file. You can safely delete this file from the location defined in AHKScriptPath in older versions of Tagger.
  • Attention: Tagger now requires at least DOpus version 11.8.2 to work because I'm using the newly added ScriptInitData property log_prefix! If you want to use Tagger with older versions of DOpus you'll have to uncomment lines 12 and 13 to make it work.

Update 28.11.2014 to version 2.2:

  • Tagger now automatically detects if the language used by DOpus is set to german and displays all dialogs and descriptions accordingly.
  • Bug fix: If tagfolders was false and the folder contained no valid files because the filter was used the invalid files were hidden but the dialog didn't appear because no valid item was left

Update 14.01.2016 to version 2.3:

  • Fixed: the temporary Autohotkey script moved all windows that contained the word "Tagger". Now only dialogs containing the string "Tagger - Directory Opus" will be moved.

Update 24.09.2016 to version 2.3:

  • Fixed: If in Script Configuration TagFolders was set to False and Filter was empty the Script didn't open.

Update 25.11.2016 to version 3.0:

  • Version 3.0 requires at least Directory Opus 12.2.3. I opened a new thread for this version because it's very different and needs a new description:

Incredible. Thanks a lot. That speeds up my whole tagging workflow quite a lot, one extra keys push for every image to save. :bulb: :arrow_right:

It works great. Only if i want to mass tag images, there could be an extra option "mass tag" or similar, using a small checkbox saying "tag all"
to keep all selected files & apply the tags to them, instead of having to add them one by one.

Update: See second post.

Thx kundal. But there is one problem: the new function should not tag all images, of course, but only all selected! For example, i have 100 pictures, & 16 images show some trees. So i have those 16 images selected, & want to give them the tag "Bäume". But only for those, not all. Sorry, if i wasn't clear about that. Actually, there are almost never situations to give all pictures the same tag, at least the way i'm using the tags.

Ok, sorry, i just found, you have some more options in the buttons, so i can tag the selected files. Very smart. I misinterpreted the fourth option, when i read it. I think, you could reverse options 2 & 4, because case 4 is more likely. Actually, i think that options 2 even might be redundant, because we can always select all files & run option 4.

Update: See second post

Thanks again, it just works. Serious stuff.

Working with this code is a treat. To enhance its abilities, i would suggest a new feature: pushing ESC closes the tagger now. If i have overlooked something in the previous image, i will have
to close the tagger, go back, & re-open it. So here is my feature request: pushing Shift-Esc would reselect the previous image, while staying in tagger mode.

Another idea would be, to have some history function for the input field, like the last used set of keywords (or up to three of them). It happens quite often, that neighboring files have similiar or the same tags, so a history would make sense: I could imagine it using the up & down arrow keys, to open the history, resp. navigate in it.

Update: See second post

@abr: Sorry, I couldn't find a way to apply a qualifier to the Cancel button of the dialog. So I had to add a new button for this. The icon was necessary because otherwise the dialog looks ugly with no space between the OK button and the left border of the dialog window.
At the moment I have no idea how a history could be added to the text field. Perhaps someone else knows if that can be done.

Update: See second post

Thank you, kundal. I just installed the new version, it works great. To keep a straight workflow using just the keyboard, i have recorded a short macro to push that button per hotkey, so the hotkey combinations for starting the tagger & going back are similar. I use Ctrl-Capslock to start Tagger, & Shift-Capslock to go back. I've set the macro to x100 speed, so it works immediately.

As an native solution, for users intending to use the keyboard, it would perhaps be a good idea, to have some accelerator keys available: "OK" would stay the same, having the default focus, so you would only have to push Enter, then "Go Back", "Clear", "Tag Selected & "Cancel". Pressing l or T would open the menues, of course, revealing the availabe options, also with accelator keys.

The history thing isn't urgent. It's only some old idea, i have requested for Opus a time ago. Maybe someone comes up with an idea, how to add that module or additional lines? I think, it is a good idea in general to have a history for tagging work, as it was when working with DOS commands.

As I said in my previous post I couldn't find a way to apply qualifier keys to the buttons of the dialog. Everything I tried only worked on the toolbar button itself which isn't useful for what you requested. Maybe it's possible and just beyond my scripting capabilities.

No problem, the button is already of tremendous help. Maybe GP likes to add the support for qualkeys one day. It could be quite handy in other scripts, too. The macro i'm using now completely intergrates into the workflow, so it's no difference if it was in the button code itself or a third party thing. Overall, the keyboard support in Opus improved massively, so there are only minor issues left (something like "Select METAPANELFOCUS=keywords" or "Select METAPANELFOCUS=MP3title", complete with being able to assign a keyboard shortcut, to give a certain department in the metapanel the focus).

I have yet another suggestion for the new "tag all" function. Currently, the first file of the tagged files will stay selected. It would make more sense to put the focus/selection after the tagged files.
For example, IMG0001, IMG0002, IMG0003 are selected, getting tagged. After that, the selection should point to IMG0004, as the best approximation of what is to be tagged next.

Bug Fix: See second post

@abr: What you suggested in your last post is not as trivial as the other changes I made for you. The other things could be done using raw commands like select first, select next, select All and select prev. There's no raw command to select the next file after a selection. My scripting capabilities are still limited and I'm not able to do this at the moment although I'm sure it's possible.

Kundal, no problem. It's always possible to set the focus manually, so don't bother. Since i have noe clues about programming or scripting, i never can tell, what is trivial or what is really complicated. So just take this as a suggestion of very minor relevance. Your code works great for its main purpose, & that is what counts. Thanks again. I'm gonna use the Tagger later this evening, because i had a new photo session this afternoon. :sunglasses: