Post Reply

Forums -> UltraMon™ -> Switching between primary & secondary scripting
Flash   2007-07-31 07:26
Is there a way to make a script (acting as a toggle switch) that will enable the secondary display then switch the primary to it, then when the script is ran again it will reverse the process so it will switch back to the primary and disable the secondary?

Basically what I want to do is have my secondary display (my tv) off, have it enabled by the script then switch the primary display from my computer monitor to my tv. Then, when I run the script again it switches the primary back to my computer monitor and disables the secondary display.

The reason for this is that some applications tend to get screwy when having dual monitors enabled (when chaning resolutions like when playing a game and the program is still running) and some games don't like to play nice with them (some RTS games don't behave well in that when you move the mouse cursor to the right of the screen to scroll the map over the mouse goes over to the secondary display). I would love to be able to have a script do this. I used to be able to use a hotkey with nvidia's nView ("Switch to next display device") but since I am now running Vista, nView is not available. Does anybody know how I can do this? I am not too good with VB scripting. Thanks!
Christian Studer   2007-08-01 03:38
I have uploaded a script which does this: ToggleSecondaryAndPrimary

Christian Studer - www.realtimesoft.com
Eric   2008-04-08 09:23
No sense in starting a new topic.

I am trying to get the same thing working on my system. The script provided above isn't working for me though. Here is what it is doing for me:
(for simplicity, I will use PC and TV for the screens)

PC is primary and active. TV is inactive.
*script*
PC is primary and active. TV is active.
*script*
PC is primary and active. TV is inactive.


I have been playing with the script some, unfortunately I believe it is in .NET and I am not familiar with it's syntax so I am getting a lot of errors due to stupid stuff. Any help is greatly appreciated.
Eric   2008-04-08 09:34
Heh, got it after just a little more playing around. :P

Just in case anyone else has the same problem I did, here is the code I got to work.

WARNING: MY CODE MAY BE UGLY AS I DON'T ACTUALLY KNOW THIS LANGUAGE, JUST DID SOME TWEAKING TO THE SCRIPTS ON THE SITE.


Set sys = CreateObject("UltraMon.System")
If sys.Monitors("1").Primary = True Then
set mon1 = sys.Monitors("1")
set mon2 = sys.Monitors("2")
mon2.Enabled = True
mon2.Primary = True
mon1.Enabled = False
sys.ApplyMonitorChanges
ElseIf sys.Monitors("2").Primary = True Then
set mon1 = sys.Monitors("1")
set mon2 = sys.Monitors("2")
mon1.Enabled = True
mon1.Primary = True
mon2.Enabled = False
sys.ApplyMonitorChanges
Else
MsgBox "This script is only intended for systems with two monitors.",, WScript.ScriptName
End If
Forums -> UltraMon™ -> Switching between primary & secondary scripting

Post Reply