Copy filenames into description

If descript.ion files are enabled in Preferences then I think they'll be used instead of NTFS metadata in all cases. They'll also only be created a little while after changes happen, or possibly after changing folders, to avoid updating the files too often.

You can use File > Exit Directory Opus to force any pending changes to be written out right away when testing what's happening. Try doing that, then go back to the folder. Is there a descript.ion file there now?

i went back to the folder and it was now created. Does that mean that if I use Windows Explorer to copy a file it will not know what to do with the descript.ion file and ignore the description when copying?

Explorer and most software won't do anything with descript.ion files.

You can turn descript.ion support on and off in Preferences. I think it's off by default.

Is there any benefit to going with descript.ion versus saving the comments to NTFS directly? I tried both ways and both work. Obviously if i copy outside of DO, the data is not preserved, but other than that is there a compelling reason to keep the descript.ion way of doing this?

descript.ion is mainly supported because it's a semi-standard that some older apps also use. If you don't have anything else that uses that format then NTFS is usually a better option. Neither way is perfect.

i decided to use the NTFS method... and ran into a problem... I often have to run this command on a few thousand photos at a time. Inevitably DO will crash. I get an error 0xC00000005 occurred in thread dopus_funtion at address 0x00007FF7747AF692.

When this happens, I need to end task DO. However, because it crashed, whatever files it was working on are messed up. What seems to happen is that the files are renamed to something strange like filename.123545 and then they go back to normal when the command is completed. However, when DO crashes, those files are left named like that. usually these files are a duplicate of what was there before, so it is safe to delete them. Except, there are times when I will be missing files at the end of it all. Luckily I have a copy and i am ok, but not sure why it is crashing. I am running this on a brand new machine.

If i run that command in smaller batches, of lets say 150 at a time, then it seems to be fine. It still does that funky renaming thing, (i notice this after the DO progress indicator has completed) and then it goes back to normal. But when I have thousands of images in a folder to do at once, doing it 150 at a time is not really the way to go.

I have also tried to run this on CR2 files on a network drive. It has never crashed that way, only on JPGs on the local computer. However, with the CR2 files, often it misses some. The CR2 files are in child directories, so i set it to view in flat mode then run that button. So I have to sort the folder by description and then run the command again on those it missed. I am not sure why it missed some and not others.

Are any crash logs created? Automatic crash logs (for bug reports)

I emailed it as requested and linked this forum's post

thanks

I just ran the command on 300 images... the progress indicator finished, but I am seeing all the files being renamed and then back to normal... and it is taking a really long time to finish. It is as if the command is running faster than the computer can handle. It is strange.

dopusrt won't wait for commands to finish so if you run the command that was above in the thread on a huge number of files, it will potentially run it on all of them at once, in parallel. You may be running out of memory or some other resource in that case, which would also explain the crashes.

Doing it on smaller batches is probably best.

This isn't ideal, obviously. You could do things better using a script, but it would be more complicated. Using dopusrt for this was always a quick kludge to provide an easy way to do this, but it may not scale to a large number of files.

As I have no idea how to script, I will have to do it in small batches. Even in small batches it takes ages to do, so I have to decide if it is worth the effort.

For those not brave enough to edit raw files :wink:

// https://resource.dopus.com/t/copy-filenames-into-description/37819/20

// 2022-08-23: log panel opens/closes automatically; processed files get temporarily deselected

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var tab = clickData.func.sourcetab;
    cmd.deselect = false;

    cmd.RunCommand('Set UTILITY=otherlog');

    for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
        var item = e.item();

        cmd.RunCommand('Select PATTERN="' + item.name + '" DESELECT');

        var cmdLine = 'SetAttr FILE="' + item + '" META "comment:' + item.name + '"';
        DOpus.Output(cmdLine);
        cmd.RunCommand(cmdLine);

        cmd.RunCommand('Select PATTERN="' + item.name + '"');
    }

    cmd.RunCommand('Set UTILITY=off');
}
Button as XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>Copy Filename to Description</label>
	<icon1>#setattr</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>// https://resource.dopus.com/t/copy-filenames-into-description/37819/20</instruction>
		<instruction />
		<instruction>// 2022-08-23: log panel opens/closes automatically; processed files get temporarily deselected</instruction>
		<instruction />
		<instruction>function OnClick(clickData) {</instruction>
		<instruction>    var cmd = clickData.func.command;</instruction>
		<instruction>    var tab = clickData.func.sourcetab;</instruction>
		<instruction>    cmd.deselect = false;</instruction>
		<instruction />
		<instruction>    cmd.RunCommand(&apos;Set UTILITY=otherlog&apos;);</instruction>
		<instruction />
		<instruction>    for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {</instruction>
		<instruction>        var item = e.item();</instruction>
		<instruction />
		<instruction>        cmd.RunCommand(&apos;Select PATTERN=&quot;&apos; + item.name + &apos;&quot; DESELECT&apos;);</instruction>
		<instruction />
		<instruction>        var cmdLine = &apos;SetAttr FILE=&quot;&apos; + item + &apos;&quot; META &quot;comment:&apos; + item.name + &apos;&quot;&apos;;</instruction>
		<instruction>        DOpus.Output(cmdLine);</instruction>
		<instruction>        cmd.RunCommand(cmdLine);</instruction>
		<instruction />
		<instruction>        cmd.RunCommand(&apos;Select PATTERN=&quot;&apos; + item.name + &apos;&quot;&apos;);</instruction>
		<instruction>    }</instruction>
		<instruction />
		<instruction>    cmd.RunCommand(&apos;Set UTILITY=off&apos;);</instruction>
		<instruction>}</instruction>
	</function>
</button>
2 Likes

Thanks. That should be fixed in the next release, so that it doesn't crash. Doing it via scripting is still better if possible, and lxp's simple script above should do the trick.

I was just testing it out a little bit before commenting...

The script works wonderfully. A little slower than the other way, but that is just fine with me. It works and does not crash, which is what is important.

One thing I noticed, and i noticed it with the original way as well... is that sometimes it does not update the description field. It will miss a few. Exiting the folder and going back in wont show the updated description. Neither will pressing F5 to refresh. Exiting the current instance of DO and opening DO again will show it though. It does not always happen, but when it does, that is how i fix it.

I like the fact that I can view the progress in the script log window. Which is really the only way to verify how the job is progressing. When I have 5000 files to do at once, it takes a while.

And these logs that it creates, do they erase automatically, or will they be somewhere on my HD and I will need to clean them out eventually.

If I start the script and wish to stop it for whatever reason, is there a way to stop it?

Does closing the window and opening a new one fix it, or do you need to restart the whole program?

My guess is the change notification system is getting overloaded with events, and dropping some to keep up.

There's a clear button at the top of the script log panel.

No good way. It can be done, if a progress dialog is added to the script, but it makes things much more complicated.

I should have been more clear. Closing the window and reopening it will do the trick. I do not have to close it from the system tray as well. It just means if I have a bunch of tabs open, I lose them all and I have to reopen them all again. Not a biggie though.

There is no need to get overly complicated with a progress indicator. This simple script does the trick and I can keep my eye out on the log window to know when it is done.

Perhaps if i close DO and close it from the systray will stop the script if need be. But I do not foresee a reason to do so unless something gets messed up.

You can probably just close the tab without closing the whole window.

That's probably the logging.

Toggling the metadata pane might help (F9).

Is there a way to open the Output window in the "other logs" section when I click this button? that way I can keep an eye on when this script ends. Right now I open it manually and then close it manually after I confirmed it is completed. I don't mind closing it manually but if I could streamline it so it will open automatically that would be swell. I don't mind either way, as I only use the script once or twice a week, so if it is not possible, then that's fine as well.

Thanks,

Yes. I have edited the script. Also added a cute little animation :slight_smile:

1 Like