Thought i would follow up to this,
Bearing in mind im a 3d artist moonlighting as a coder/programmer, I found this pretty robust when testing it. Just using your dotnet code to do the check and actionMan. to execute it. The setcheck seem to uncheck UI but the function was still active in background when testing if sme was open or closed. I know it shouldnt matter too much if closed but the ui was flickering whilst global rendering updated, so just thought its best to kill it regardless. none the less couldnt of solved it without your help. Thanks again
(
sme_hwnd = windows.getchildhwnd 0 "Slate Material Editor"
sme_rend_tb = windows.getchildhwnd sme_hwnd[1] "toolbar_rendering"
_ = UIAccessor.GetFirstChildWindow sme_rend_tb[1]
rend_bt = UIAccessor.GetNextWindow _
g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
cb = g.GetICustButton rend_bt
cb.IsChecked
if sme.IsOpen() then (
-- print "sme open"
if cb.IsChecked == true do
(
print "sme open on"
(SME.GetMainframe()).SetFocus()
actionMan.executeAction 369891408 "55572"
)
)
else
(
--print "sme not open"
if cb.IsChecked == true do
(
print "sme not open on"
(SME.GetMainframe()).SetFocus()
actionMan.executeAction 369891408 "55572"
)
)
)