DialogMonitorOps not works simultaneously from two different scripts


#1

Hi!

In this video you can see the problem:

https://drive.google.com/open?id=1wHqFOUJ6wRH8PRUdc10QEKo3ks3wiPJy

I use one script from denisT and one from maxscript Reference file. Both scripts uses DialogMonitorOps but when I run both scripts only one of the DialogMonitorOps works. The other is “suspended”.

Is this is a default behaviour or there is a solution of the problem?


#2

Mxs reference has a somewhat misleading description of DialogMonitorOPS callback return value.

That’s the reason you see only one callback is executing
SDK reference:
firefox_ahxYJWdv1u

This one will work as you expect it to, but UI redraw glitches make it unusable. :smile:

DialogMonitorOPS.UnRegisterNotification()

fn Callback1 = 
(
	format "callback 1\n"
	false
)

fn Callback2 = 
(
	format "callback 2\n" 
	false
)

DialogMonitorOPS.Enabled = false
DialogMonitorOPS.Interactive = false

DialogMonitorOPS.RegisterNotification Callback1 id:#cb1
DialogMonitorOPS.RegisterNotification Callback2 id:#cb2
DialogMonitorOPS.Enabled = true

But even if it wasn’t a problem to have multiple callbacks working, how can you be sure that someone’s script will keep DialogMonitorOps enabled?


#3

Thank you. If the returned value is FALSE no window can’t be open, which makes DialogMonitorOps unusable.

DialogMonitorOPS.unRegisterNotification id:#eyeInTheSky
 
fn dmnotification =
(
 WindowHandle = DialogMonitorOPS.GetWindowHandle()
 format "Dialog Window Handle: %\n" WindowHandle
 format "Dialog Name: %\n" (UIAccessor.GetWindowText WindowHandle)
 format "Window Class Name: %\n" (UIAccessor.GetWindowClassName WindowHandle)
 format "Window Resource ID: %\n" (UIAccessor.GetWindowResourceID WindowHandle)
 format "Is Window: %\n" (UIAccessor.isWindow WindowHandle)
 format "Window DLL Filename: %\n" (UIAccessor.GetWindowDllFileName WindowHandle)
 format "Window DLL Description: %\n" (UIAccessor.GetWindowDllDescription WindowHandle)
 UIAccessor.SetWindowText WindowHandle" All Your Windows Are Belong To Us"
 format "=====================\n"
 false
)
DialogMonitorOPS.RegisterNotification dmnotification id:#eyeInTheSky
DialogMonitorOPS.Enabled = true
DialogMonitorOPS.ShowNotification()

Maybe the best way for such tasks is to use timers(with background worker).