Ok this is my script that..
Turns on secondary monitor (TV)
Sets resolution 1920x1080
Sets refresh rate to 50Hz
Switches primary display to TV
Disables PC Monitor output
And then when I press again..
Enables secondary monitor (PC Monitor)
Sets resolution 1680x1050
Sets refresh rate 60Hz
Switched primary display to PC Monitor
Disables TV output
It takes about 5 seconds.
Code:
Const POS_ALL = &H7
Const POS_ICONS = &H2
Const POS_DESKTOPITEMS = &H4
'Enable Secondary
Set sys = CreateObject("UltraMon.System")
sys.SavePositions POS_ICONS Or POS_DESKTOPITEMS
If sys.NumActiveMonitors > 1 Then
Else
'enable secondary monitors
For Each mon In sys.Monitors
If mon.Enabled = False Then
mon.Enabled = True
End If
Next
'sys.RestorePositions POS_ALL
End If
Set mon1 = sys.Monitors("1")
mon1.Width = 1680
mon1.Height = 1050
mon1.Colordepth = 32
mon1.refreshRate = 60
Set mon2 = sys.Monitors("2")
mon2.Width = 1920
mon2.Height = 1080
mon2.Colordepth = 32
mon2.refreshRate = 50
WScript.Sleep DELAY * 1000
'Switch Primary
For Each mon In sys.Monitors
If mon.Primary = False Then
mon.Primary = True
Exit For
End If
Next
WScript.Sleep DELAY * 1000
sys.ApplyMonitorChanges
'Disable Secondary
'sys.SavePositions POS_ALL
For Each mon In sys.Monitors
If mon.Primary = False And mon.Enabled = True Then
mon.Enabled = False
End If
Next
sys.RestorePositions POS_ICONS Or POS_DESKTOPITEMS
sys.ApplyMonitorChanges
This one basically switches on the extra monitor if it isn't already on, if it is on then it disables it, I think. I seldom use this one.
Code:
Const POS_ALL = &H7
'Enable Secondary
Set sys = CreateObject("UltraMon.System")
If sys.NumActiveMonitors > 1 Then
'disable secondary monitors
sys.SavePositions POS_ALL
For Each mon In sys.Monitors
If mon.Primary = False And mon.Enabled = True Then
mon.Enabled = False
sys.ApplyMonitorChanges
End If
Next
Else
'enable secondary monitors
For Each mon In sys.Monitors
If mon.Enabled = False Then
mon.Enabled = True
End If
Next
sys.RestorePositions POS_ALL
End If
Set mon2 = sys.Monitors("2")
mon2.Width = 1920
mon2.Height = 1080
mon2.Colordepth = 32
mon2.refreshRate = 50
sys.ApplyMonitorChanges
You can do all this stuff through the right click event on the Ultramon taskbar icon but it's so much easier to use a script.