As part of my transition to MM5, I need to migrate some tools that I use to manage my collection. One such tool is a spellcheck that I developed. The good news in the code below is that it doesn't crash. The bad news is that it doesn't open Word. Any suggestions?
// A simple script that checks the spelling of a Song Title
actions.SpellCheck = {
title: _('Spell Check'),
hotkeyAble: true,
disabled: uitools.notMediaListSelected,
visible: window.uitools.getCanEdit,
execute: async function () {
// Define variables
let list = uitools.getSelectedTracklist();
var objWord = new ActiveXObject("Word.Application");
objWord.visible = True;
objWord.options.autoFormatAsYouTypeReplaceQuotes = false;
var objDoc = objWord.documents.add;
//added count to give word a chance to catch up.
for(let intCnt = 1; intCnt <= 1000000; intCnt++) {
intCnt = intCnt + 1;
};
// Get list of selected tracks from MediaMonkey
list.forEach(lstItem => {
objDoc.activate;
objDoc.content.text = lstItem.title;
objDoc.CheckSpelling;
let str = objdoc.Content.Text
lstItem.title = str.substring(0, str.Length - 1);
});
// Write all back to DB and update tags
list.commitAsync();
objDoc.saved = false;
objDoc.close (0);
objDoc = null;
objWord.options.autoFormatAsYouTypeReplaceQuotes = true;
objWord.quit;
objWord = null;
alert("Spell Check is complete.");
}
}
window._menuItems.editTags.action.submenu.push({
action: actions.SpellCheck,
order: 40,
grouporder: 30
});
TIA
MPG
Triumph - Hold On: Music holds the secret, to know it can make you whole.
ActiveX was never really supported all that well in chrome (and firefox for that matter) because they used NPAPI for their plugins. There are some guides and plugins to make activeX work for chrome, but keep in mind that MediaMonkey may behave differently for this kind of low-level plugin stuff, so your mileage may vary. Unless the developers of mediamonkey deliberately accounted for this use case, it might not work at all for you.
TIV73's got it right. That's one of the reasons why the VBS2JS plugin was removed from SampleScripts, because it's kind of incomplete (Sorry about that). We're having a discussion now on whether we can add the ability to execute VBS code from JS. Either way, however, you could use a JavaScript-only spellchecker. That way, you don't have to depend on MS Word being installed (and it'll work on Linux and Mac OS when MM5 is eventually ported there). I'm sure there's a free JS spellchecking library out there that fits your purpose. After searching for a few seconds, here's a couple: https://www.javascriptspellcheck.com https://github.com/MichaelWehar/Open-So ... ll-Checker https://github.com/cfinke/Typo.js/
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
It's unfortunate that MM5 doesn't support ActiveX Objects. It is going to make replicating the MS Word functionality rather difficult. Especially for an old VB programmer like myself.
TIA
MPG
Triumph - Hold On: Music holds the secret, to know it can make you whole.
Sorry about that. Hopefully we can find some sort of solution that can re-add that functionality. Will keep you posted if something happens.
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.