Post Reply

Forums -> UltraMon™ -> Cannot get monitor position right on re-enable
Eric Taylor   2017-11-14 21:04
One of my monitors on HDMI loses its connection every so often, and often when I change ultramon profiles.

I believe this is because it’s connected through one of those cheap $15 ebay hdmi switchers.

When this happens, I have to switch the monitor to another hdmi input and then back. This works kinda, but it is a pain.

I wrote a script to toggle the monitor on/off. But when it is re-enabled, it's in the wrong place, usually on the right of the others, not where it was when enabled.

Is there a way in scripting to get it to return to the original position on re-enabling it?



Set sys = CreateObject("UltraMon.System") Set mon = sys.Monitors("3") If mon.Enabled = True Then mon.Enabled = False sys.ApplyMonitorChanges Else mon.Enabled = True sys.ApplyMonitorChanges End If
Christian Studer   2017-11-14 22:41
On Windows 7 and later the stored settings for disabled monitors are frequently invalid, to set the position explicitly you'll have to set the Left and Top properties:

mon.Left = -1024 mon.Top = 256

Christian Studer - www.realtimesoft.com
Eric Taylor   2017-11-15 10:06
Thanks, the below works.

Is there a reason I couldn't use a variable named "left", is that a reserved word? I kept getting errors until I changed it.

Set sys = CreateObject("UltraMon.System") Set mon = sys.Monitors("3") leftx = mon.Left topx = mon.Top mon.Enabled = False sys.ApplyMonitorChanges WScript.Sleep 4000 mon.Left = leftx mon.Top = topx mon.Enabled = True sys.ApplyMonitorChanges MsgBox ("re-enabled with top=" & topx & " Left = " & leftx)
Christian Studer   2017-11-15 14:10
Yes, Left is a VBScript function, returns a specified number of characters from the left side of a string.

Christian Studer - www.realtimesoft.com
Forums -> UltraMon™ -> Cannot get monitor position right on re-enable

Post Reply