Page 1 of 3

Replace String 1.0

Posted: Sat Nov 20, 2021 5:40 am
by frank1969a
Can someone tell me HOW the Replace String 1.0 plugin works
OR if it really doesn't work with 5.0.2 (I see, only 5.0.0 and 5.0.1 is listed, but for 5.0.2 is a minor update, so I guessed, it would work).

I give the "existing" String (eg. Tiƫsto) and the "new" string (eg. Tiesto) - it says, it replaces 123 files - but nothing happens...?

Re: Replace String 1.0

Posted: Sun Nov 21, 2021 2:00 pm
by MPG
Hi,
Frank contacted me privately and this is what he found:

Installed the 5.0.1.2433 in English language.
After that, the add-on worked fine!

Then he re-installed the most recent beta 5.0.2.2519 - and it works fine too.
What I noticed: Within the installation of 5.0.2.2519 it asked me to install a new language plugin for German. So maybe THIS was the reason?

Fact is: The issue is caused by language and NOT by 5.0.2 obviously!

So now it runs fine for me and I love Your tool already.

replace string

Posted: Tue Dec 07, 2021 1:26 pm
by pip_pill
using replace string...

The addon only replaces the first instance of a string, it does not do all the instances in the string

ie "Destination Field:" Artist - replacing , with ;

1) untouched
NEIKED, Mae Muller, POLO G
2) first run
NEIKED; Mae Muller, POLO G
3) second run
NEIKED; Mae Muller; POLO G
Therefor it does not replace , with ; .......

Re: Replace String 1.0

Posted: Wed Dec 08, 2021 10:37 am
by Erwin Hanzl
@MPG
corrected code: successfully tested several times replaceAll

Re: Replace String 1.0

Posted: Wed Dec 08, 2021 11:21 am
by MPG
Thank you for the suggestion. I'll make the change and post an update!

Re: Replace String 1.0

Posted: Wed Dec 08, 2021 12:39 pm
by MPG
New version has been uploaded which now does a replacement of all instances of the search string.

Re: Replace String 1.0

Posted: Wed Dec 08, 2021 1:40 pm
by Erwin Hanzl
@MPG
Thanks for your effort.
However, the update is not yet available.

Re: Replace String 1.0

Posted: Wed Dec 08, 2021 1:52 pm
by MPG
Likely needs to be reviewed and approved by the MM developers before being available.

Re: Replace String 1.0

Posted: Wed Dec 08, 2021 6:42 pm
by Peke
Hi,
all addons approved.

Re: Replace String 1.0

Posted: Thu Dec 09, 2021 2:25 am
by Erwin Hanzl
@MPG
Sorry, but version Replacestring 1.1. does not work.
(Yes, I changed the language to "English" beforehand)
NO ENTRY: context menu
NO ENTRY: Tools menu> Edit tags

I have rewritten the code in the version Replacestring1.0. in file: dlgReplaceString.js
OLD: str.replace
NEW: str.replaceAll


AND IT WORKS IN MM5.0.2.2524 AND 2526

P.S .: You should also rework the window.
thanks

Image

Re: Replace String 1.0

Posted: Thu Dec 09, 2021 4:05 pm
by MPG
I have posted a new version, 1.1.1 that will fix the context menu issue and will allow users to resize the form in case the drop down is cut off. It'll be available once approved by the MM5 add-on team.

Re: Replace String 1.0

Posted: Thu Dec 09, 2021 11:07 pm
by drakinite
Approved.

I would still recommend the following change to fix the UI glitch:
Change the dropdown's parent's class from "noWrap" to "flex row" (like the others below it), remove the dropdown's style and replace it with the "fill" class. It will then change size according to the window size.

Re: Replace String 1.0

Posted: Fri Dec 10, 2021 1:45 am
by Erwin Hanzl
@MPG

Please change the following code in Version "Replace String 1.1.1"
OLD: str.replace(edtSearchStr, edtReplaceStr);
NEW: str.replaceAll(edtSearchStr, edtReplaceStr);

Otherwise ONLY the first character in the string is changed.
Thank you.

Code: Select all

	switch(ddDestination){
		case "All":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.title;
				itmRec.title = str.replaceAll(edtSearchStr, edtReplaceStr);

				str = itmRec.artist;
				itmRec.artist = str.replaceAll(edtSearchStr, edtReplaceStr);

				str = itmRec.album;
				itmRec.album = str.replaceAll(edtSearchStr, edtReplaceStr);

				str = itmRec.albumArtist;
				itmRec.albumArtist = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
		case "Title":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.title;
				itmRec.title = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
		case "Artist":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.artist;
				itmRec.artist = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
		case "Album":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.album;
				itmRec.album = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
		case "Album Artist":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.albumArtist;
				itmRec.albumArtist = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
	}

Thanks for the corrected window.

Image

Re: Replace String 1.0

Posted: Fri Dec 10, 2021 9:26 am
by MPG
Okay, not sure what happened, but the replaceAll was missed on some of the updates. That is now fixed. Also changed the window style again to be a bit more flexible on the dropdown. Be sure to download version 1.1.2 for the latest updates. Thank again everyone for your suggestions. Glad to see that you are finding it useful.

Re: Replace String 1.0

Posted: Fri Dec 10, 2021 6:07 pm
by drakinite
Thank you for developing addons for MM5 and sharing them! :slight_smile: