How to expose python commands to keyboard shortcuts in Max

max
python

#1

Hi all,

I have some python tools that I want the user to be able to assign keyboard shortcuts to.

I have added these as menu items so they appear in the Customise User Interface by using MaxPlus.ActionFactory.Create.
However I can’t assign a keyboard shortcut to them under the Customise User Interface, it lists the commands and I can choose to assign a key but afterwards the ‘Remove’ button is still disabled and no shortcut works.
Even after saving the keyboards file it is not assigned.

I’m creating a action for each tool to it can be launch via the menus using:
# – create action definition for menu item
tool_action = MaxPlus.ActionFactory.Create(
category,
name,
cmd,
)

Any ideas how to get this to work?
I can see ActionItem has a GetShortcutString but not a Set.
I’m using MaxPlus in Max 2018.4

Cheers all.


#2

The easiest way would be to expose the functionality as functions and create regular macroscripts importing the module from MAXScript and then calling the function.


#3

Thanks for the reply.
I was hoping to avoid macroscripts as we have kept the Max installation vanilla.