Const SHOWSTATE_NORMAL = 2

Set wnd = CreateObject("UltraMon.Window")
If wnd.GetForegroundWindow() = True Then
	Set sys = CreateObject("UltraMon.System")
	
	'get the monitor the window is on
	Set mon = sys.Monitors(wnd.Monitor - 1)
	
	'fit window to the top half of the monitor workspace area
	wnd.ShowState = SHOWSTATE_NORMAL
	wnd.Left = mon.WorkLeft
	wnd.Top  = mon.WorkTop + (mon.WorkHeight / 2)
	wnd.Width = mon.WorkWidth
	wnd.Height = mon.WorkHeight / 2
	
	wnd.ApplyChanges 0
End If