Message 1 of 8
Python (pymxs.runtime) DialogueMonitorOPS not behaving properly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to utilize the DialogueMonitorOPS and UIAccessor in a python script to be able to handle dialogue windows. While testing the example in the documentation with the MaxScript version everything worked perfectly. When I went to convert it all over to Python using the pymxs.runtime module, it doesn't do the same thing. It appears to have worked at first (no errors) but after running it, NONE of the menus work and none of the dialogues will pop up. Here is my converted code:
from pymxs import runtime as rt
rt.DialogMonitorOPS.unRegisterNotification(ID="#eyeInTheSky")
def handleDialogues():
win_handle = rt.DialogMonitorOPS.GetWindowHandle()
print "Dialog Window Handle: {0} - (#{1})\n".format(win_handle, type(win_handle))
print "Dialog Name: {0} - (#{1})\n".format(rt.UIAccessor.GetWindowText(win_handle), type(rt.UIAccessor.GetWindowText(win_handle)))
print "Window Class Name: {0} - (#{1})\n".format(rt.UIAccessor.GetWindowClassName(win_handle), type(rt.UIAccessor.GetWindowClassName(win_handle)))
print "Window Resource ID: {0} - (#{1})\n".format(rt.UIAccessor.GetWindowResourceID(win_handle), type(rt.UIAccessor.GetWindowResourceID(win_handle)))
print "Is Window: {0} - (#{1})\n".format(rt.UIAccessor.isWindow(win_handle), type(rt.UIAccessor.isWindow(win_handle)))
print "Window DLL Filename: {0} - (#{1})\n".format(rt.UIAccessor.GetWindowDllFileName(win_handle), type(rt.UIAccessor.GetWindowDllFileName(win_handle)))
print "Window DLL Description: {0} - (#{1})\n".format(rt.UIAccessor.GetWindowDllDescription(win_handle), type(rt.UIAccessor.GetWindowDllDescription(win_handle)))
rt.UIAccessor.SetWindowText(win_handle, " All Your Windows Are Belong To Us")
print "=====================\n"
rt.DialogMonitorOPS.RegisterNotification(handleDialogues, ID="#eyeInTheSky")
rt.DialogMonitorOPS.Enabled = True
rt.DialogMonitorOPS.ShowNotification()
Honestly, I am a little unsure of how this even works so any thorough explanations as to what I did wrong would be greatly appreciated. My guess is the ID="#eyeInTheSky" argument isn't working like it's supposed to. Any help would be great. Thanks.

