aareleb Posted August 7, 2013 Posted August 7, 2013 Hello everyone, I am a complete newb to autoit and would like a little help. I would like to make a script that will disconnect one of my monitors and extend the desktop to my TV. At the moment I do it manually by going to control Panel>Appearance and Personalization>Display>Screen Resolution Then I select display 1 (my tv) and extend to desktop and then select display 2 ( one of my monitors) disconnect display. I also have a 3rd monitor connected as my main monitor. I dont want you guys to write a script for me but just help me getting started "point me in the correct direction". Thank you Aareleb.
0xdefea7 Posted August 8, 2013 Posted August 8, 2013 Post some code and I'll help you with it. I'm not going to write it for you Just quickly searching, I came up with this link: '?do=embed' frameborder='0' data-embedContent>> Also, you can accomplish what you want but opening the target cpl and using the Send() command to send the Tab key.
aareleb Posted November 29, 2014 Author Posted November 29, 2014 Here is the script I created for this topic Thank you. It is not that great but my first script. Let me know what you guys think. Aareleb expandcollapse popup#include <GUIConstantsEx.au3> Global $Timer1 = 500; Global $Timer2 = 150; Global $ScreenResScreen1 = "rundll32.exe shell32.dll,Control_RunDLL desk.cpl"; Global $ScreenRes1 = "Screen Resolution"; Global $DisplaySettings1 = "Display Settings"; Global $ComboBoxInstance1 = "[CLASS:ComboBox; INSTANCE:1]"; Global $ComboBoxInstance2 = "[CLASS:ComboBox; INSTANCE:2]"; Global $ComboBoxInstance3 = "[CLASS:ComboBox; INSTANCE:3]"; Global $ButtonInstance1 = "[CLASS:Button; INSTANCE:1]"; Global $ButtonInstance4 = "[CLASS:Button; INSTANCE:4]"; Global $Up1 = "{UP}"; Global $Down1 = "{DOWN}"; Local $aGUI = GUICreate("Switcher v1.0", 258, 114, 401, 181) $TV1 = GUICtrlCreateButton("TV", 5, 14, 100, 35) $Monitor1 = GUICtrlCreateButton("Monitor", 152, 14, 100, 35) GUISetState(@SW_SHOW, $aGUI) While 1 Switch GUIGetMsg() case $GUI_EVENT_CLOSE Exit ;disable Monitor (HP w1907) and enable HDTV Case $TV1 Run($ScreenResScreen1) Sleep($Timer1) WinSetTrans($ScreenRes1, "", 0) Sleep($Timer2 ) ControlSend($ScreenRes1, "",$ComboBoxInstance1, $Up1) ; Selects display #1 Sleep($Timer2 ) ControlSend($ScreenRes1, "",$ComboBoxInstance3, $Up1) ;Sets display #1 "extend desk top to this display" Sleep($Timer2 ) ControlSend($ScreenRes1, "",$ComboBoxInstance1, $Down1) ; Selects display #3 Sleep($Timer2 ) ControlSend($ScreenRes1, "",$ComboBoxInstance1, $Down1) ; Selects display #3 Sleep($Timer2 ) ControlClick($ScreenRes1, "",$ComboBoxInstance3 ) ;Sets display#3 "Disconnect this display" Sleep($Timer2 ) ControlSend($ScreenRes1, "",$ComboBoxInstance3, $Down1) ;Sets display#3 "Disconnect this display" sleep($Timer2 ) ControlClick($ScreenRes1, "",$ButtonInstance4) ;Clicks "OK" Button Sleep($Timer2 ) WinActive($DisplaySettings1) ;Waits for display settings screen Sleep($Timer2 ) ControlClick($DisplaySettings1, "",$ButtonInstance1) ;Clicks Keep button Exit Case $Monitor1 ;Disable HDTV and enable Monitor (HP w1907) Run($ScreenResScreen1) Sleep(500) WinSetTrans($ScreenRes1, "", 0) Sleep($Timer2) ControlSend($ScreenRes1, "",$ComboBoxInstance3, $Down1) Sleep($Timer2) ControlSend($ScreenRes1, "",$ComboBoxInstance1, $Down1) Sleep($Timer2) ControlSend($ScreenRes1, "",$ComboBoxInstance1, $Down1) Sleep($Timer2) ControlSend($ScreenRes1, "",$ComboBoxInstance3, $Up1) Sleep($Timer2) ControlClick($ScreenRes1, "",$ButtonInstance4) Sleep($Timer2) WinActive($DisplaySettings1) Sleep($Timer2) ControlClick($DisplaySettings1, "",$ButtonInstance1) ;Clicks Keep button Exit EndSwitch WEnd
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now