Anyone know how to deal with activeX in 3ds Max?

I'm trying to achieve serial communication in 3ds max by accessing activex control, mscomm

Below is my script:

utility ActiveXTEST "ActiveX Test"

(
rollout mscommtest "MSCOMM TEST" width:200 height:300
(
ActiveXControl MSComm1 "MSCOMMLib.MSComm.1" \
pos:[3,5] width: 156 height: 191

button btn1 "Connect COM 1" pos:[24,131] width:110 height:27
on btn1 pressed do
(
MSComm1.Settings = "2400,N,8,1"
MSComm1.CommPort = 1
MSComm1.PortOpen = True
)
slider sl1 "Servo 1" type:#integer orient:#vertical ticks:0 range:[0,255,128]
on sl1 changed value do
(

MSComm1.Output = "255"
MSComm1.Output = "0"
MSComm1.Output = "value"

)
)
on ActiveXTEST open do
(
addRollout mscommtest
)
)

i can access to com port but when i move the slider, 2 messages box appears:

-(maxscript rollout handler exception):
Runtime error: cannot set the property, .output

-(maxscript)
this property needs an index, use setIndexedProperty #output

Can anyone help me with this? i donno why this happen and i donno how to use the "setIndexedProperty #output" function...

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lutteral's picture

maybe using dotNet instead of

maybe using dotNet instead of activeX ?
here i've found some info on dotNet and com ports:
http://www.codeproject.com/kb/dotnet/DotNetComPorts.aspx

cheers,

Anubis's picture

I not work with activeX but I

I not work with activeX but I guess that .Output expect integer value (not a string), so just try:

on sl1 changed value do
(
    MSComm1.Output = value
)

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.