Run a TOOL Command, based on selection, in a SINGLE WINDOW

It is always MUCH easier if the statements about working or not working functions are a LOT more detailed.
What did you do to create the export?
Did you get any error messages?
Which step did not work?

My apologies. I did as instructed, and the text file produced:

mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E01"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E02"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E03"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E04"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E05"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E06"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E07"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E08"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E09"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E10"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E11"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E12"
mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E13"

Then, I changed the file extension to .bat, and ran the script. The dates weren't changed, post running the .bat

So, did you check the syntax for your tool?
I mean, the script itself produced a valid output right?
Which messages did you get when running the batch file?

There was no message: command window opened and closed rapidly. Nonetheless, I have never ran a .bat file without adding the directory, along with other necessary components, below, which is why I am confused on how to proceed:

**for %%x in (*.mkv .mka .mks) do "C:\Program Files\MKVToolNix\mkvpropedit.exe" "%%x"

you could open a command shell in the folder where the bat file is located.
Then run the batch file from the command shell prompt.

Apologies, but I was unable to comprehend what you asked of me, but, with one draw back, in which I will elaborate on, I did manage to figure it out via a previous post, provided by @poster, passing multiple selected items to external tool - #3 by tezza

The only draw back, from the MTE below, is that I can only process/export one file at a time, regardless of when I select the files I want processed or not. Moreover, I created an "ACTION" which did not work at all, for some reason. Anyway, you or anyone in this post can tell me what I am missing in the attacked .mte below

mkvpropedit_set creation time to encoded time.mte (2.0 KB)

I am the author of the script you used.
It was written to execute an application that allows multiple files as command line arguments.
But I believe that mkvpropedit allows only 1 file on it's command line.
I have attached a modified script to execute mkvpropedit, once for each file.
1Tools___Execute_Application-multiple_times_once_for_each_file.mte (1.8 KB)

However, there is minimal error-handling or notification of success or failure.

Maybe you would rather use the simpler script as described by @ohrenkino.
If so, take note of the following modifications:

  • Unless mkvpropedit is in your path, you must use the fully qualified path, for example:
    "C:\Program Files\MKVToolNix\mkvpropedit.exe"

  • Also, I believe that mkvpropedit command lines expect a MKV file, for example: "C:\any path\to\movie.mkv"
    In Mp3tag, the placeholder is %_path%.

  • The BAT file will not execute if encoded with UTF-16. Use UTF-8 instead, as shown.

$filename($getEnv(USERPROFILE)\Desktop\mkv.bat,utf-8)$loop(%_path%)"C:\Program Files\MKVToolNix\mkvpropedit.exe" --edit info --set date="%creation_time%" "%_path%"

This will create a BAT file on the Desktop that will execute if you click "Yes" when Mp3tag asks "Display Export file now?".
(Make sure you show a message when exporting tags: Options > Messages > check-mark "at exporting tags")

Thank you. IT WORKED PERFECTLY. Likewise, @ohrenkino, thank you as well: I guess I was confused because the file path was for mkvpropedit was absent, and I have never used an MTE file. Nonetheless, @ryerman, could you explain to me why the MTE file doesn't work when an create an Action for it?

1 Like

When an "Export" is performed using the menu on the toolbar, there is the opportunity to "display" the file that is created.
But what actually happens is that the file is opened (ie executed) by whatever default application is associated with the created file type, given by the extension.
That happens if you click "Yes" when Mp3tag asks "Display Export file now?"
So a BAT file would be executed by the Command window, a TXT file might be opened by Notepad, a VBS file might be opened by the Wscript script engine, etc.

When an export is used as an action, Mp3tag does not ask the question "Display Export file now?" and there is no opportunity to display/execute/run the created export file.

If you must use an action to perform an export, you can always create the exported file in a convenient place (like the Desktop), and open it manually.

Did you try the 3 line export script in my previous post?

Yes, sir, I did, and it worked. Thanks, again, I really appreciate the assistance.

1 Like

Sorry for bothering you, but would you mind helping me out with this VBS script. I successfully created, from your 3-line code template, a 3-line code, which I titled "SUCCESSFUL...mte," but I am unable to apply this same process on the VBS script in the file titled "UNSUCCESSFUL...mte." Moreover, in the VBS script, under the CommandArguments, line 35, I deleted the text in inside the quotation marks since it's inapplicable regarding the command entry that I wanted to implement.

SUCCESSFUL_3 line export script_MKVPropEdit FREE-FORM (BAT file executed).mte (164 Bytes)

What do you expect the scripts to do?
What is the contents of %mp3propedit_freeform%?
How is the script unsuccessful?

You must be more specific when asking for help! :slightly_smiling_face:

But for starters, you forgot the single quotes when you changed "%creation_time%" to "%mp3propedit_freeform%" in Line 28

SelectedFilesDictionary.Add "'%_path%'", "%mp3propedit_freeform%"'
Should be:
SelectedFilesDictionary.Add "'%_path%'", "'%mp3propedit_freeform%'"'

%mp3propedit_freeform% should contain the complete command line arguments, except for the file path. Hopefully, that is true.

My apologies for being vague. Usually, I am very detailed, but I guess I am doing a poor job. Nonetheless, thanks for responding. As for what I am trying to accomplish, from the first image attached, titled "Free-form objective.png," which works using the 3-line code you prescribed, it's a failure when I attempt to perform that same task using VBS-script. Moreover, as for the second image, titled "Line 28 Error.png," the error appears after your recommendation of returning line 28 to match the same format as the first VBS script that you sent me regarding the creation time. SelectedFilesDictionary.Add

"'%_path%'", "'%mp3propedit_freeform%'"'

Basically, what I am trying to achieve, that has already been achieved via your 3-line code, is that I can implement a command line such as --edit track:a1 --set flag-default=1 --edit track:s1 --set flag-default=1 --set flag-forced=0 --set name="English: Signs/Lyrics" --set language=eng --edit track:s2 --set flag-default=0 --set flag-forced=0 --set name="Full Translation" --set language=eng, in the %mp3propedit_freeform% field, and mkvpropedit.exe will actually run and fulfill the command. This works using your 3-line code, which I am very grateful for, but it's unsuccessful when I attempt it using VBS-script. I believe the problem likely comes from Line 35 because from the first VBS script you sent to me, Line 35's CommandArguments = "--edit info --set date=". However, it's not applicable for this command line because I am not trying to change the date. I hope I am being as detailed as possible lol. And thanks again for responding.

Don't worry about it. It is sometimes difficult to ask succinct questions with all the necessary information. :wink:
Your new command line contains double quotes and I suspect they are not handled properly by my script.
I will do some investigation and testing to figure out a solution, then reply again.

thank you, sir. I appreciate it

Double quotes were the issue.
I have enough trouble with them in VBS scripts alone, never mind trying to write a VBS script with the Mp3tag MTE script language. :slightly_smiling_face:
If the attached script fails, I may need a copy of one of your MKV files for further testing.
You can post a link to a file sharing service.

And here's a "heads-up": single quotes have a special function in Mp3tag scripting so they might need special handling to be used literally.

CORRECTED_Jan11_2022_VBS script_MKVPropEdit_ FREE FORM.mte (1.8 KB)

It worked. Thank you so much. I really appreciate it. There is no way that I would have been able to figure it out, given the fact I just glanced at your corrections. All of this could have been avoided if Mkvmerge.exe had a command line to preserve the original "Encoded date" because when it comes to handling mkv files, mkvtoolnix (mkvmerge.exe, mkvpropedit.exe), in my opinion, surpasses FFmpeg :grinning:. Nonetheless, thanks again. I really appreciate the help.

1 Like

One more question, if I wanted to include MKA as a list of extension for the script to read, how do I go about modifying Line 27 in the VBS script you just sent me?

' if LCase("'%_extension%'") = "mkv" then'

Never mind, I figured it out below:

' if LCase("'%_extension%'") = "mkv" OR ("'%_extension%'") = "mka" then'

1 Like

Good. :+1:
But the comparisons are case sensitive, so you might want to use the "Lower Case function", like this:
' if LCase("'%_extension%'") = "mkv" OR LCase("'%_extension%'") = "mka" then'

Thank you, sir. Hope you don't mind me, in the future, asking you for assistance because it was pure luck that I managed to insert multiple extensions :grinning:. Thanks, again