Hi, I'm trying two methods to press the default buttons of the 'V-Ray warning' dialog but neither are working.
If I evaluate
uiAccessor.getWindowText (dialogMonitorOps.getWindowHandle())it returns
undefinedI know I can use this (But, that doesn't have a false switch):
setVRaySilentMode()It's just, I need to get this to work with other scripts I've been working on, not just the V-Ray warning dialog. I've not gotten this to work for a while now and I'm nearly sure that it's something to do with my system.
Here's the two methods I've tried:
/* METHOD 1 */
clearlistener()
dialogMonitorOps.unRegisterNotification id:#VrayButtonYes
fn DiaMonOps_CloseVray = (
local hwnd = dialogMonitorOps.getWindowHandle()
local hwndChild = UIAccessor.GetChildWindows hwnd
for i in hwndChild where uiAccessor.getWindowText i == "V-Ray warning" do
(
-- uiAccessor.pressButtonByName hwnd "&Yes"
uiAccessor.pressDefaultButton()
)
true
)
dialogMonitorOps.enabled = true
dialogMonitorOps.interactive = false
dialogMonitorOps.registerNotification DiaMonOps_CloseVray id:#VrayButtonYes
/* METHOD 2 */
clearlistener()
dialogMonitorOps.unRegisterNotification id:#VrayButtonYes
fn DiaMonOps_CloseVray = (
local hwnd = dialogMonitorOps.getWindowHandle()
if uiAccessor.getWindowText hwnd == "V-Ray warning" do
(
-- uiAccessor.pressButtonByName hwnd "&Yes"
uiAccessor.pressDefaultButton()
)
true
)
dialogMonitorOps.enabled = true
dialogMonitorOps.interactive = false
dialogMonitorOps.registerNotification DiaMonOps_CloseVray id:#VrayButtonYes
-- setVRaySilentMode()
By
Comments (6)
Comment policy
You can use Spy++ to determine parent of this message window and all the other info you may need.
btw. Any idea of how to get this warning window? Curious to test it myself.
`
probably is not linked to max window
try this:
Yeah, that worked. Thanks.
But I'm finding it hard to understand why the function is not firing using:
It seems that 'DialogMonitorOPS.RegisterNotification' function method is not working for me because the function is not fired every time a dialog pops up.
Sooooo..., I found the problem!!
From this thread, I found out that startup scripts could be the culprit.
https://forums.autodesk.com/t5/3ds-max-programming/maxscript-dialogmonit…
I managed to find that it was a startup script in the user startup folder. Needless to say, it was one that I wrote. I've yet to find the culprit part but just glad I've found the issue.
Now to fix it!
Thanks P and sorry for wasting your time ;)
The warning window is created after opening an old version of a vray file in a newer install.
It's the one where it asks you, yes to update or no to render as was.
You cannot close this dialog via the Ops method.
PS. It was a startup script of my own that was hijacking the system and preventing it from firing. Yet to find the part of the script which caused the problem.
`
Hi, try with print to see what is exact window title
try to use also findString title "v-ray" or findString title "v-ray warning"
Thanks.. This sucks! That doesn't work. It's like it's not firing the function.
What does this return for you?
I get
I've checked the list of active OPS and it displays the one you gave, so somethings not quite right. My fresh install of 2017 is the same.