Const TIMEOUT = 15 'time in seconds the script will try to find the application's main window

Const WNDCHANGE_CLIP_TO_WORKSPACE = 2
If WScript.Arguments.Count <> 2 Then
	MsgBox "Usage: <application> <monitorNumber>" & vbNewline & "application: can include command-line arguments",, WScript.ScriptName
	WScript.Quit
End If

Set util = CreateObject("UltraMon.Utility")
If util.Run(WScript.Arguments(0)) = True Then
	Set wnd = CreateObject("UltraMon.Window")
	If wnd.GetAppMainWindow(util.ProcessId, TIMEOUT * 1000) = True Then
		wnd.Monitor = CLng(WScript.Arguments(1))
		wnd.ApplyChanges WNDCHANGE_CLIP_TO_WORKSPACE
	End If
End If