I found this thread researching options to resolve a similar sync need, and followed the suggestion to clone and modify the swapArtistTitle script to achieve both incrementing the playCounter and Last Played date (I drive a few smart playlists from Last Played). Here it is if it helps anyone:
Code: Select all
// C:\Program Files (x86)\MediaMonkey 5\Scripts\setLastPlayed\actions_add.js
// A simple script that sets last played
actions.setLastPlayednow = {
title: _('Set Last Played to now'),
hotkeyAble: true,
disabled: uitools.notMediaListSelected,
visible: window.uitools.getCanEdit,
execute: async function () {
var list = await uitools.getSelectedTracklist().whenLoaded();
if (list. Count === 0) {
return;
}
var msg = sprint(_('Are you sure that you want to set Last Played to now on %d files ?'), list.count);
messageDlg(msg, 'Confirmation', ['btnYes', 'btnNo'], {
defaultButton: 'btnNo',
title: _('Set Last Played to now'),
}, function (result) {
if (result.btnID === 'btnYes') {
var tmp;
list.forEach(function(itm) {
// Swap the fields
itm.beginUpdate();
itm.lastTimePlayed_UTC = app.utils.timestamp2DateTime( new Date().toISOString());
itm.playCounter = itm.playCounter + 1;
itm.endUpdate();
});
list.commitAsync();
}
});
}
}
window._menuItems.editTags.action.submenu.push({
action: actions.setLastPlayednow,
order: 22,
grouporder: 10
});