Thanks, even though I don’t want to touch (learn) .net yet, after “do” in your example a common maxscript stuff can follow?
This is all just common Max script really, it is just calling on dotNet to test the keyboard input. Since you can cut and paste what I have put there it wouldn’t be a problem for you to start using it in your scripts right now.
Dochtor, yeah dotNet is a little scary at first, but it’s not that bad, really. Plus you can do alot of awesome stuff with it that maxscript can’t, so it’s a definately worth looking into at some point.
Thanks Pen! That’s works perfect. Using that I can now access/use mouse buttons too
timer theTimer interval:1000 active:true
local con = dotNetClass "system.windows.forms.control"
on theTimer tick do
(
if con.MouseButtons==con.MouseButtons.middle do
(
print "wee"
)
)
The above code has to be in a Rollout menu though dochtor, if you are looking to test this. This is because of the Timer.
You can also use a dotNet timer. Have a search and you will find some threads on it here I’m sure. If you use the dotNet timer you don’t need to have a rollout.
How would you check if any key is pressed? I checked the properties but they all seem to refer to certain keys.
I took a look at the msdn page but obviously don’t know what to look for…I wanted to know this for quite some time but it never was worthy enough to open a new thread.
none is also one of the properties. So…
if con.modifierKeys!=con.modifierKeys.none do...
con = dotNetClass "system.windows.Forms.Control"
theTimer = dotNetObject "System.Windows.Forms.Timer"
fn printKey = (
if con.modifierKeys != con.modifierKeys.none do print "wee"
)
dotnet.addEventHandler theTimer "tick" printKey
theTimer.interval = 1000
theTimer.start()
--theTimer.stop()
I tried it like this but it only prints “wee” if you press shift, alt or ctrl. Sorry for the thread hi-jacking.
No problem, my questions have been answered, so go on, this is also interesting.