PDA

View Full Version : Keyboard shortcuts.


la_piaga
04-06-2004, 12:08 PM
I am wondering how to use keyboard shortcuts in max scripts. I thought i'd found some script targetable slots in the shortcuts assignment requester, but nothing like that. Any suggestions?
Tnx.

Bobo
04-06-2004, 04:50 PM
Originally posted by la_piaga
I am wondering how to use keyboard shortcuts in max scripts. I thought i'd found some script targetable slots in the shortcuts assignment requester, but nothing like that. Any suggestions?
Tnx.


Since Max 4, the keyboard, toolbars, quad-menus and menus systems were unified to use the so-called ActionItems.
This means that an action can be defined by a plug-in or script and then can be assigned to either a keyboard shortcut, a menu or a toolbar using the Customize>Customize UI... menu.

To create an ActionItem in MAXScript, you have to define a MacroScript (which was introduced in Max 3 as a container of MacroRecorder code, but then expanded into the main type of script as it was placeable on toolbars as button or icon). So in Max 4,5 and 6 you can define a MacroScript, evaluate it, go to the Customize dialog and find it in the respective category. From there, you can assign a keyboard shortcut to it.

A simple MacroScript has the general form

MacroScript TheScriptName category:"Your Category"
(
--enter the script code here.
)

There are some cool handlers available in Max 4 and up to define the visibility of the item when in QuadMenus (context-sensitive scripts!), to enable/disable or toggle the button when on a Menu/Toolbar. Then, in Max 5 and 6 you can also add Alternative Execution methods (for example the option boxes seen in QuadMenus) etc.

See the MAXScript Online Help for more info...

Cheers,
Bobo

la_piaga
04-06-2004, 05:13 PM
Wow! Thanks Bobo, Really clear and helpful :)

CGTalk Moderation
01-18-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.