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

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)
UNSUCCESSFUL_VBS script_MKVPropEdit_ FREE FORM.mte (1.8 KB)

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

Sure, I'm happy to help.
For issues that do not concern Mp3tag, we should use the "Off-Topic" section or maybe the forum's "Message" system.
This thread started OK, but we are now getting into non-Mp3tag areas. :slightly_smiling_face:

Yes sir. Thank you, and I will do that the next time

Good evening, sir. On this page, you authored a VBS script for me early January of this year, CORRECTED_Jan11_2022_VBS script_MKVPropEdit_ FREE FORM.mte, and I was wondering if you would be able to verify if I correctly implemented my second argument, located on Line 45, after the first argument on Line 28, or is there a way to implement both arguments on Line 28 because piping was unsuccessful, and I did not want to create another .mte file? Thus, the modified script, from your original, works flawlessly, but I just wanted verification from you concerning if I am moving in the right direction of adding a secondary argument? Likewise, the intended script was supposed to be -c "%win_create_date%" -m "%win_modify_date%", but WinTestGear_FileTouch.exe only recognized and changed the file modification date, while neglecting the creation date, which led me to separate both arguments, as seen in Lines 28 and 45. I attached my modified version of your VBS Script.

MODIFIED_WinTestGear's FileTouch v1.0.0.3 (Windows OS) (12-23-2009).mte (5.0 KB)

There is probably several other ways to do what your modified script does, but "If it ain't broke, don't fix it."
I don't know the format of whatever is in WIN_CREATE_DATE or WIN_MODIFY_DATE.
I used mm/dd/yyyy for testing and saw no problems.

If %win_modify_date% and %win_create_date% are the same for each file, you could combine the FileTouch.exe switches and eliminate the second loop.
But I guess you already knew that.

Indeed you are absolutely correct "if it ain't broke, don't fix it" lol. Nonetheless, not sure if you use FileTouch, but the one recommended to me via the mp3tag community, FileTouch command line utility, was insufficient because it required separation of date and time into separate fields. Thus, I found this one Download File Touch 1.0.0.3, and it works flawlessly when coupled with your VBS Script because, for example, if I wanted to illustrate September 1st 2027 9:25:00 AM, it can be represented like any one of these on an Mp3Tag field:

2027-9-1 9:25:002027/9/1 09:25:002027-09-01 9:25:00 AM 9-1/2027 09:25:009-1-2027 09:25:0009-01-2027 09:25:00September 1 2027 9:25:00September 1, 2027 9:25:00 AMSep 1, 2027 9:25:00 AM1 September 2027 09:25:001 Sep 2027 09:25:00

WinTestGear's FileTouch v1.0.0.3 (12-23-2009).zip (25.4 KB)

Thanks. That's the one I used for testing.
I couldn't find any documentation that explained what date formats were supported.
I used the format shown in the examples, but it is good to know that others are allowed.

You're welcome, sir, but I cannot take all the credit here because your VBS Script did wonders for it since without it, I would have to use the TOOLS option which will yield multiple windows. Therefore, thank you. Now, at my leisure, I will try to find a 3rd party command line program that can edit Windows Explorer File Properties "Details" tab for mp4/m4a on the Origins field (i.e. Directors, Producers, Writers, etc) because Mp3Tag seems to not support those fields, and houses them within the %itunmovi% tag field. If successful on my quest, I will post it here.

Good evening, sir. Apologies for bothering you once again. I was wondering if you can help me in regards to your .MTE file (my modification is attached below), concerning the implementation of FFmpeg.exe. Florian released a User-defined TOOLS parameter for ffmpeg.exe ➤➤ -i "%_filename_ext%" -c copy -metadata creation_time="%ryerman_mte%" -y "%_folderpath%\%_filename%_out.mp4", and it worked perfectly under TOOLS, but with multiple CMD windows on multiple files. However, when I tried to execute the same parameter under your .MTE file, it wouldn't execute at all. Moreover, when I included the placeholder, %_folderpath%, behind the %_filename_ext%, such -i "%_folderpath%\%_filename_ext%", changing the overall script to -i "%_folderpath%\%_filename_ext%" -c copy -metadata creation_time="%ryerman_mte%" -y "%_folderpath%\%_filename%_out.mp4", the command line parameter worked on the .MTE file, but it yielded a 32 KB mp4 output, and DESTROYED the ORIGINAL .mkv input file. The destruction of the ORIGINAL input file typically occurs when I employed, from Line's 28, SelectedFilesDictionary.Add "'%_path%'" or SelectedFilesDictionary.Add "'%_filename_rel%'". Likewise, it preserves the ORIGINAL input file when I substitute Line's 28, SelectedFilesDictionary.Add "'%_path%'" with SelectedFilesDictionary.Add "'%_directory%'", "'%_folderpath_rel%'", "'%_parent_directory%'", or "'%_workingpath%'", but yields a 0 KB mp4 output file. I believe the issue likely stems from placeholder(s).

ORIGINAL file Preserved_ FFmpeg with ryerman's FREEFORM VBS Script (July 2nd 2022).mte (3.1 KB)

Maybe.
But I think there are also fundamental issues that are causing problems.
I originally tried to create a VBS script that could be applied to different command lines.
I had assumed that all command lines have the same format, but that is not true.
The attached replacement uses a more generalized format that should accomodate any command line.
The tricky part is composing the command line.

The script, like any script, is easily broken, especially if you are not relatively competent in VBS scripting.
It's admirable that you tried to adapt the script to your own needs but perhaps you are unfamiliar with VBS scripting.
For example, all the keys in the dictionary data structure must be unique and an error will be raised if you attempt to add a duplicate.
Also, %_folderpath% includes a trailing backslash, so %_folderpath%\%_filename_ext% will expand with 2 backslashes before the filename.

I'm puzzled by all the file extensions you check for and allow, but that shouldn't cause an execution problem.
However, some of the MP4 files that are created were unplayable when I tested them using VLC.
Files converted from FLAC, TTA, WAV, WMA, WV and APE caused errors.

I have no idea how you populate %ryerman_mte%, so maybe the test string I used caused problems. Or maybe my files are corrupt in some way.

Anyhow, try the attached script.
EDITED (July 15, 2022) file Preserved_ FFmpeg with ryerman's FREEFORM VBS Script (July 2nd 2022).mte (3.6 KB)