APPS = Array("Untitled - Notepad", "Realtime Soft - *") 'caption of the windows which should get positioned, can contain a wildcard (*)
POS = Array("2", "1300,100,400,300") 'position of each window. a single number means maximized on that monitor, otherwise enter left and top position, optionally followed by width and height

Set wnd = CreateObject("UltraMon.Window")
For i = 0 To UBound(APPS)
	If UBound(POS) < i Then
		MsgBox "Position missing for app " & APPS(i) & ".",, WScript.ScriptName
		WScript.Quit
	End If
	
	If wnd.Find(APPS(i), "", 1, 0, 0) = True Then
		posVals = Split(POS(i), ",")
		numPosVals = UBound(posVals) + 1
		If numPosVals < 1 Then
			MsgBox "Invalid position value for app " & APPS(i) & ".",, WScript.ScriptName
			WScript.Quit
		End If
		
		If numPosVals = 1 Then
			wnd.Monitor = CLng(posVals(0))
			wnd.ShowState = 3 'maximized
		Else
			wnd.Left = CLng(posVals(0))
			If numPosVals >= 2 Then wnd.Top = CLng(posVals(1))
			If numPosVals >= 3 Then wnd.Width = CLng(posVals(2))
			If numPosVals >= 4 Then wnd.Height = CLng(posVals(3))
			wnd.ShowState = 2 'normal
		End If
		wnd.ApplyChanges 0
	End If
Next
