Notifications
Clear all

[Closed] keypress callback

How do I create dot net based call back to activate a small function (playsound()) on a keyboard press? Thank you for your time.

7 Replies
 lo1

as part of a dotnet dialog or just generally in max?

Oh just generally in max …the documentation seems to cover just shift alt ctrl presses for custom shortcuts…

well there is the dotnetform … dotnetObjectSystem.Windows.Forms.Keys…not sure how to implement…

 lo1

Using the windows.forms keyup and keydown events will only be relevant if a form has focus.
For a general 3dsmax callback you need to either:

  1. define a low-level callback (there’s a thread here somewhere about a low-level mouse callback, maybe that can be a start)
  2. define you action as a macroscript and find away to automatically assign it to a hotkey

yes I think the macro script is the way to go…thnx

For the latter part, have a look at either:
http://code.google.com/p/outliner/source/browse/trunk/maxscript/script/keyboardActionsFile.ms
for a maxscript way of automatically assigning a hotkey, or here
http://code.google.com/p/scriptcenter/source/browse/trunk/ScriptCenter/ScriptCenter/Max/KbdFile.cs
http://code.google.com/p/scriptcenter/source/browse/trunk/ScriptCenter/ScriptCenterTest/Max/KbdFileTest.cs
for a .NET implementation and its unit tests for usage examples.

 lo1

Thanks for sharing, very nice.