'Copyright 2001 by Realtime Soft

Dim mon, mon2, monP, sys
Set sys = CreateObject("UltraMon.System")

If sys.NumActiveMonitors <> 2 Then
	MsgBox "This script only works on systems with 2 monitors."
	WScript.Quit
End If

For Each mon In sys.Monitors
	If mon.Enabled = True Then
		If mon.Primary = False Then
			Set mon2 = mon
		Else
			Set monP = mon
		End If
	End If
Next

If IsObject(mon2) = True And IsObject(monP) = True Then
	If mon2.Left < 0 Then
		'move secondary monitor to the right
		mon2.Left = monP.Width
	Else
		'move secondary monitor to the left
		mon2.Left = -mon2.Width
	End If
	sys.ApplyMonitorChanges
End If