Sign in to follow this  
Followers 0
Haggisdog

Automating Screen Resolution Change - Win7

12 posts in this topic

I'm a new AutoIt user and struggling with what is probably such a basic concept that I haven't been able to find any help on it.

I would like to create a simple script that starts up the Windows 7 Screen Resolution dialog from Control Panel and extends my desktop to each of my three monitors.

I've used Auto v3 Windows Info to capture the address (Address: Control Panel\Appearance and Personalization\Display\Screen Resolution) but I'm not sure how to call the dialog to the screen and then select the Extend Desktop option.

PS. I'm doing this so I can switch from my EyeFinity group which used all 3 monitors for playing games back to Windows for controlling my extended desktop.

Thanks for any help that can be provided.

Share this post


Link to post
Share on other sites



wellcome to Autoit Forum.

Did you mean this:

Run("rundll32.exe shell32.dll,Control_RunDLL desk.cpl")

Regards

1 person likes this

Share this post


Link to post
Share on other sites

Thanks for the reply on this, I have to confess I doubt I would have figured that command out :-) At least I can experiment with creating a script now!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Also Haggisdog, u might want to look into this topic

You could easily take code their, twink and a few things and it changes res :)

Also Danny, i do wonder ^^ Did the copy/Paste that from the other topic or did u know it ? :D

Edited by IanN1990

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks for sharing the topic thread above. You're right that person was attempting something very similar (the only significant difference being that I am doing this for 3 monitors not 2). However, I have to confess the ControlSend function is completely foreign to me and I wasn't able to get that script to run.

However, I think this is an incredibly straightforward script. I've mapped out the "tab" sequence but I'm having a problem with two things:

  • The WinActivate doesn't seem to be activating the Screen Resolution window and the key sequences keep getting pasted back into my AutoIt script. It works OK if I have the Screen Resolution dialog already open but it's not waiting for the dialog to appear before continuing the key sequence.
  • I'm not sure how to automate the dialog box that pops up after the screen resolution is changed that asks whether you want to "Keep" or "Revert" your changes.

Run("rundll32.exe shell32.dll,Control_RunDLL desk.cpl")
WinActivate("Screen
Resolution","Control PanelAppearance and PersonalizationDisplayScreen
Resolution")
Send("{TAB
3}")
SEND("{DOWN}")
SEND("{TAB}")
SEND("{UP}")
SEND("{TAB}")
SEND("{DOWN}")
Send("{TAB
4}")
Send("!A")
Edited by Haggisdog

Share this post


Link to post
Share on other sites

I am in the same situation. I am trying to setup the following:

Open Screen Display Settings

Extend the display for two monitors.

Move the 2nd monitor to the left of the 1st monitor.

Make the 2nd monitor the primary monitor.

Set both monitors resolution to the same setting (not sure what I want it at for the moment).

Exit.

Have you made any progress with extending your displays?

I am just into the "search google, search forums, look over existing code to get a handle on how it all works" phase.

Share this post


Link to post
Share on other sites

I just confirmed I will need monitor 2 @ 1920x1080 and monitor 1 @ 1360x768.

(Weird, I can't edit my posts yet.)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You need at lest 5 posts to be able to edit :)

If you check the link in Post 4. That should get you started

For the second step of "moving" windows. You have 2 options i can think of.

ClickandDrag

or

MouseDown

MouseMove

MouseUp.

but these are not "control" fuctions. So u will need to make sure the window is visible, in the same space every time, with no windows blockin or ontop of it :)

Edited by IanN1990

Share this post


Link to post
Share on other sites

IanN1990 - Thanks for the clarification on posting. I must say, this is one of the most "on top of it" forums I have read in a while. IE, they have their crap together on how it will be ran.

Curiosity - If the screens are set in the proper order, resolution, etc.... Is there not a way to export the registry settings or whatever settings file that is storing the current settings and then potentially pushing those settings back into place manually, rather than going through the process of automating the window and commands?

Share this post


Link to post
Share on other sites

Honestly i wouldn't know, i assume it is possible as everything is stored in registery and then u just need 2 update it but that can get very complex and u need to understand how to send windows message.

My advice would be, try to automate first and that fails then go for the more complex ideas

Share this post


Link to post
Share on other sites

This is what I came up with. I append this to the end of a preset I have in the AMD Vision Engine Control Center that disables the monitoring extending after I finish playing WoW. Works like a charm now,

Run("rundll32.exe shell32.dll,Control_RunDLL
desk.cpl")
Sleep(500)
WinActivate("Screen Resolution","Control
PanelAppearance and PersonalizationDisplayScreen Resolution")
Send("{TAB
3}")
SEND("{DOWN}")
SEND("{TAB}")
SEND("{UP}")
SEND("{TAB}")
SEND("{DOWN}")
Send("!A")
SEND("{TAB}")
Sleep(500)
Send("{ENTER}")

Share this post


Link to post
Share on other sites

I found this topic and eventually moved onto other stuff. Thought I would report back the resolution I found. You can use http://12noon.com/?page_id=80 to change resolution and arrangement via command lines which work nicely with AutoIT.

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