I've got the callback for when SME is open from MSX help and I've tried to reverse engineer it to work when it's closed.
I've never used dialogmonitorops or UIAccessor before so any help would be appreciated.
Code I've got so far:
clearlistener()
DialogMonitorOPS.unRegisterNotification id:#mxs_test_open
DialogMonitorOPS.unRegisterNotification id:#mxs_test_closed
fn SlateCallbackOpen = (
clearlistener()
h = dialogmonitorops.getwindowhandle() -- get current popup window
if UIAccessor.GetWindowText h == "Slate Material Editor" then (
print "Slate Material Editor is opened"
print (UIAccessor.GetWindowClassName h)
print (UIAccessor.GetWindowText h)
)
true
)
fn SlateCallbackClosed = (
clearlistener()
h = dialogmonitorops.getwindowhandle() -- get current popup window
if UIAccessor.GetWindowText h != "Slate Material Editor" then (
print "Slate Material Editor is closed"
print (UIAccessor.GetWindowClassName h)
print (UIAccessor.GetWindowText h)
)
true
)
-- register dialog monitor callback notificition
dialogmonitorops.registernotification SlateCallbackOpen id:#mxs_test_open
dialogmonitorops.registernotification SlateCallbackClosed id:#mxs_test_closed
-- enable dialog monitor
dialogmonitorops.enabled = true
By 3dwannab · 2016-09-11