Page 1 of 1

[REQ] Add new item in Hotkey list

Posted: Fri Jan 12, 2024 10:11 am
by sonos
To complete tags I often use the action 'Edit tags - open track Folder in MP3Tag ...'. Now I wanted to define a hotkey, but I can't find one in the hotkey list of actions.

Therefore my wish would be to add an 'action': open track Folder in MP3Tag ... to this list.

Carsten

Re: Add new item in Hotkey list

Posted: Fri Jan 12, 2024 10:34 am
by Lowlander
Users can't add new hotkey actions.

Re: [REQ] Add new item in Hotkey list

Posted: Fri Jan 12, 2024 11:10 am
by sonos
Sorry, I expressed myself in a misleading way. I do not wish to add this entry myself. Rather, it is my wish that this entry should be added to this list.

Re: [REQ] Add new item in Hotkey list

Posted: Fri Jan 19, 2024 10:22 am
by Ludek
Therefore my wish would be to add an 'action': open track Folder in MP3Tag ... to this list.
Hi Crasten, I guess this action was added by an addon/script?

At first the action needs to be in the actions and then have attribute 'hotkeyAble: true'

See: [MM5 install folder]/sampleScripts/hokteyAction/

You can move it from the /sampleScripts/ to /scripts/ folder to have this sample script active..

The code is just:

Code: Select all

actions.myCustomAction = {
    title: 'My Custom Action',
    hotkeyAble: true,
    execute: function () {
        messageDlg('This action was created by hotkeyAction script.', 'information', ['btnOK'], {
            defaultButton: 'btnOK'
        }, undefined);
    }
}

hotkeys.addHotkey('Ctrl+Shift+Q', 'myCustomAction');

Re: [REQ] Add new item in Hotkey list

Posted: Fri Jan 19, 2024 12:03 pm
by sonos
Hi Ludek,
thank you for help to add the hotkey.
I just inserted the following line:

Code: Select all

hotkeys.addHotkey('Ctrl+Shift+O', 'openFolderMP3Tag');
with reference to the already existing action part

Code: Select all

actions.openFolderMP3Tag = {
    title: _('Open Track-Folder in MP3Tag ...'),
    icon: 'openMP3Tag',
    disabled: uitools.notMediaListSelected,
    visible: window.uitools.getCanEdit,
    execute: async function () {	
	var list = await uitools.getSelectedTracklist().whenLoaded();
        
	if (list.count === 0) {
            return;
        }

        list.forEach(function(itm) {
		var AppParameters = '/fp:"' + itm.path + '"'
		app.utils.shellExecute(AppPathMT, AppParameters)	
        });       
    }
}
I have omitted the part

Code: Select all

actions.myCustomAction = { ....}
Carsten

Re: [REQ] Add new item in Hotkey list

Posted: Fri Jan 19, 2024 1:38 pm
by Ludek
OK, so I guess that you just need to add the

Code: Select all

 hotkeyAble: true,
to the actions.openFolderMP3Tag object//

Re: [REQ] Add new item in Hotkey list

Posted: Fri Jan 19, 2024 3:04 pm
by sonos
Hi Ludek
Interestingly, it also works without

Code: Select all

hotkeyAble: true,
Nevertheless, I have added this to the

Code: Select all

actions.openFolderMP3Tag = { --.
inserted
This is how it looks now:

Code: Select all

actions.openFolderMP3Tag = {
    title: _('Open Track-Folder in MP3Tag ...'),
    icon: 'openMP3Tag',
    disabled: uitools.notMediaListSelected,
    visible: window.uitools.getCanEdit,
    hotkeyAble: true,
    execute: async function () {	
	var list = await uitools.getSelectedTracklist().whenLoaded();
        
	if (list.count === 0) {
            return;
        }

        list.forEach(function(itm) {
		var AppParameters = '/fp:"' + itm.path + '"'
		app.utils.shellExecute(AppPathMT, AppParameters)	
        });       
    }
}
hotkeys.addHotkey('Ctrl+Shift+O', 'openFolderMP3Tag');
Any comments? And thank you again
Carsten

Re: [REQ] Add new item in Hotkey list

Posted: Tue Jan 23, 2024 10:00 am
by Ludek
Hmm,
I guess that once 'hotkeyAble: true' is missing then it won't show in Options > Hotkeys as availbale hotkey action.