Heyho!
i am currently messing around with max script a bit, trying to understand it and learn the commands, so i'm really new to this. For training i wrote this small script:
macroScript checkSelCount category:"Custom"
(
rollout checkSelCount "checkSelCount" width:132 height:63
(
edittext edt " " pos:[4,5] width:116 height:22
button btn "Update selection" pos:[3,33] width:122 height:23
)--end rollout
fn check_sel_count = (
if selection.count == 0 then
checkSelCount.edt.text = "Nothing selected" else
if selection.count > 1 then
checkSelCount.edt.text = "Multiple selected" else
checkSelCount.edt.text = "''" + $.name as String + "''" + " selected"
)--end function
on btn pressed do
(
check_sel_count()
)--end on
createDialog checkSelCount 132 63
checkSelCount.edt.readOnly = true
check_sel_Count()
)--end macroScript
It should simply print out in the edittext-field if nothing, one or multiple objects are selected (on start or when i hit the update button. I already had this working, but after i restarted max, i got lots of errors with undefined properties and after changing the order of some things, i now always get a an "unknown system exception".
I guess it's really simple to solve, but i'm stuck. Any ideas? And is there a better way to check if anything has been selected? And why do i sometimes get a Number in the Listener after evaluating my script, instead of "OK"?
Screenshot: http://s5.directupload.net/file/d/1969/o5wbx2l5_jpg.htm
Greetings :)
By br0t · 2009-11-05
Anubis · 2009-11-06