press OK btn after copying an object with SHIFT

Is it possible to press ok in script when copying with shift automatically?

fn handleBox =
(
local windowHandle = DialogMonitorOPS.GetWindowHandle()
if (windowHandle != 0) then
(
local title = UIAccessor.GetWindowText WindowHandle
format "\tWindow Title: %\n" title to:f_error
format "\tWindow Body:\n" to:f_error
local children = UIAccessor.getChildWindows windowHandle
for child in children do
(
format "\t\t%\n" (UIAccessor.getWindowText child) to:f_error
)
--local error = UIAccessor.GetWindowDllDescription WindowHandle
UIAccessor.PressDefaultButton()
true
)
else ( false )
)
DialogMonitorOPS.RegisterNotification handleBox id:#hello
DialogMonitorOPS.Enabled = true

but it is not working!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
artrender.info's picture

oh

if so, then there is no reason to move it outside!
Anyway, thank you both, Barigazy and miauu

miauu's picture

To place the rollout outsied

To place the rollout outsied of the screen use this:

(
	global rol_
	try(destroyDialog rol_)catch()
	rollout rol_ ""
	(
 
	)
	rol_width = 100
	rol_height = 100
	rol_posX =  -150
	rol_posy = 600
	createdialog rol_ rol_width rol_height rol_posX rol_posy
)

To make the dialog visible - run the code above, but with positive value for rol_posX. If you mean to hide the clone options window - may be you can do it, but the window will appear in the center of the screen and then will be moved outside of the screen.

I will take a look on cgtalk thread this evening.

artrender.info's picture

or at least

is it possible to put this window pos[x,y] out of the screen? wow, I've just seen you word - outside of the screen!
So, how to put flickering window outside of screen?
and then to put it back to the center if needed

barigazy's picture

If you are looking solution

If you are looking solution outside desktop screen then you can use this
let say that your rollout have width 200 and height 100

-- center position
x = roll.width --=200
y = roll.height --=100
posX = ((dotNetClass "Screen").PrimaryScreen.WorkingArea.Width/2) - x/2
posY = ((dotNetClass "Screen").PrimaryScreen.WorkingArea.Height/2) - y/2
-- to go outside the screen
posX = -(x+1) --1px more then width
posY = -(y+1) --1px more then height

barigazy

artrender.info's picture

thx miauu

you're script is working great! In fact it can be used like it is already, but if you want, you can take a look at this thread

http://forums.cgsociety.org/showthread.php?f=98&t=1110477

artrender.info's picture

I've done this

global theTimer
  	fn onTick =
  	(
  		try(
  				local RollOutHandle = (windows.getChildHWND 0 "Clone Options" )[1] 
  				UIAccessor.PressButtonByName RollOutHandle "OK"	
  			)
  		catch()
  	)
  	theTimer = dotNetObject "System.Windows.Forms.Timer";
  	theTimer.interval = 1; --ms
  	dotnet.addEventHandler theTimer "tick" onTick
  	theTimer.start()
  	--theTimer.Stop()

But it is still not what I want! I will prepare the question better then! Thx for you wish to help!

miauu's picture

The script is ready.

The script is ready. :)

(
	global theTimer
  	function onTick =
  	(
  		try
		(
			child = (windows.getChildHWND 0 "Clone Options" )
			if child != undefined do
			(
				for btn in (windows.getChildrenHWND child[1]) where (btn[5] == "OK") do
				(
					UIAccessor.PressButton btn[1]
				)					
			)
		)
  		catch()
  	)
  	theTimer = dotNetObject "System.Windows.Forms.Timer";
  	theTimer.interval = 1
  	dotnet.addEventHandler theTimer "tick" onTick
  	theTimer.start()
  	--theTimer.Stop()
)

Instead of dotNet timer you can use the default maxscript timer. The rollout that you have to create can be placed outside of the screen.

miauu's picture

What exactly do you want to

What exactly do you want to do? Can you show as a gif image or a video, where we can see what have to be done?

artrender.info's picture

I was just trying

to press CTRL+E on window pop up!

artrender.info's picture

dialogMonitorOps.unRegisterNo

dialogMonitorOps.unRegisterNotification id:#test
fn checkDialog = (
local hwnd = dialogMonitorOps.getWindowHandle()
if (hwnd == 0) then ( false )
else (
format "==================================================\n"
format "%\n" hwndText
local children = uiAccessor.getChildWindows hwnd
format "--------------------------------------------------\n"
for child in children do (
format "%\n" (uiAccessor.getWindowText child)
)
format "==================================================\n"
--uiAccessor.pressDefaultButton()
UIAccessor.PressButtonByName hwnd "&Yes"
true
)
)
 
dialogMonitorOps.enabled = true
dialogMonitorOps.interactive = false
dialogMonitorOps.registerNotification checkDialog id:#test
--loadMaxFile "c:\\temp\\atextfile.txt" silent:true
--dialogMonitorOps.enabled = false

this doesn't help also

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.