Sign in to follow this  
Followers 0
baraider

Switch on/off extend monitor among 3 displays

3 posts in this topic

First, thanks very much for this wonderful program. I've been trying to write some code in vba/C# to do the samething. So happy to find this program.

I saw a script that will toggle on/off the extension for second monitor. I have 3 monitors and I want to toggle on/off extend monitor 1 and 3 while monitor 2 (the center one) is primary.

Is there something about TAB I need to learn because the number of TAB in the script and the number you do manually are not identical in some case.

I'd like to have an general idea so in the future I want to keep monitor 1 primary, and turn on/off extend monitor 2,3 for example.

; exec cpanel app `display settings`

Run("C:\WINDOWS\system32\control.exe desk.cpl,@0,3")

; wait for window to be active

WinWaitActive("Display Properties")

; select 2nd display

Send("{TAB}")

Send("{DOWN}")

; work back to the extend desktop controls

Send("+{TAB}")

Send("+{TAB}")

Send("+{TAB}")

Send("+{TAB}")

Send("+{TAB}")

Send("+{TAB}")

Send("+{TAB}")

; toggle extend desktop control and apply

Send("{SPACE}")

;select 3rd display

;Send("{TAB}")

;Send("{DOWN}")

Send("{ENTER}")

Share this post


Link to post
Share on other sites



I was able to get this to work using the following code. A problem I still have is that when i select/deselect to extend monitor 1 and 3, the monitor arrangement changes.

I have it's in 1 - 2 - 3 order and when I choose to deselect 1,3, the monitor arrangement is 2 -1 -3.

Anyone know if I can use any key shortcuts to toogle them back at the end of my script ?

; exec cpanel app `display settings`
Run("C:\WINDOWS\system32\control.exe desk.cpl,@0,3")

; wait for window to be active
WinWaitActive("Display Properties")

; select 1st display
Send("{TAB}")
Send("{UP}")

; work back to the extend desktop controls
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")

; toggle extend desktop control and apply
Send("{SPACE}")

;select 3rd display
Send("{TAB}")
Send("{DOWN}")
Send("{TAB}")
Send("{DOWN}")

; work back to the extend desktop controls

Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")



; toggle extend desktop control and apply
Send("{SPACE}")

Send("{ENTER}")

Share this post


Link to post
Share on other sites

It's been 3 months and I wonder if anyone has any hints for me?

tks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0