Opening MS Word

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Opening MS Word

Re: Opening MS Word

by drakinite » Sat Oct 16, 2021 12:33 pm

Sorry about that. Hopefully we can find some sort of solution that can re-add that functionality. Will keep you posted if something happens.

Re: Opening MS Word

by MPG » Sat Oct 16, 2021 10:59 am

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.

Re: Opening MS Word

by drakinite » Fri Oct 15, 2021 2:25 pm

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/

Re: Opening MS Word

by TIV73 » Fri Oct 15, 2021 2:31 am

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.

Opening MS Word

by MPG » Thu Oct 14, 2021 6:22 pm

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?

Code: Select all

// 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
});

Top