Const EXE = "%ProgramFiles%\Adobe\Reader 10.0\Reader\AcroRd32.exe" 'application to launch, in this case Adobe Reader X
FILES = Array("K:\Temp\test1.pdf", "K:\Temp\test2.pdf") 'files which should get opened
WND_CAPTIONS = Array("test1.pdf - Adobe Reader", "test2.pdf - Adobe Reader") 'window caption of each file
MONITORS = Array(1, 6) 'number of the monitor each file should be put on
FULLSCREEN = True 'True if fullscreen mode should be used, False otherwise
TERMINATE_EXISTING_INSTANCES = True 'True if existing instances of the application should get closed at startup, False otherwise
DELAY_APPSTART = 5 'number of seconds to wait for the application to start
DELAY_FULLSCREEN = 1 'number of seconds to wait between switching the application to fullscreen mode and moving the window to the target monitor

Set sh = CreateObject("WScript.Shell")
Set wnd = CreateObject("UltraMon.Window")

If TERMINATE_EXISTING_INSTANCES = True Then
	exeExp = sh.ExpandEnvironmentStrings(EXE)
	wndFound = False
	For Each w In wnd.GetAppWindows(False)
		If StrComp(w.ProcessExe, exeExp, 1) = 0 Then
			w.Close
			wndFound = True
		End If
	Next
	
	If wndFound = True Then WScript.Sleep DELAY_APPSTART * 1000
End If

For i = 0 To UBound(FILES)
	sh.Run """" & EXE & """ """ & FILES(i) & """"
	If wnd.Find(WND_CAPTIONS(i), "", 1, 0, DELAY_APPSTART * 1000) = True Then
		If FULLSCREEN = True Then
			wnd.Activate
			sh.SendKeys "^l"
			WScript.Sleep DELAY_FULLSCREEN * 1000
		End If

		wnd.Monitor = MONITORS(i)
		wnd.ApplyChanges 1 + 2 'WNDCHANGE_RESIZE_TO_FIT + WNDCHANGE_CLIP_TO_WORKSPACE
	End If
Next
