bmueller Posted February 20, 2009 Share Posted February 20, 2009 (edited) Hi folks, i wrote a little script to switch the primary monitor in Vista. I need to click at the control [CLASS:Monitor32; INSTANCE:2] which changes to [CLASS:Monitor32; INSTANCE:1] after a click on it (the other monitor gets INSTANCE:2 then). Well, sounds quite easy, bt when i use the following command, the settings dialog is opened but no click is performed: Run ("RunDll32.exe shell32.dll,Control_RunDLL desk.cpl") WinWait("Anzeigeeinstellungen") WinActivate("Anzeigeeinstellungen") (...) ControlClick ( "Anzeigeeinstellungen", "", "[CLASS:Monitor32; INSTANCE:2]") What did i do wrong? Thank you very much in advance. Edited February 20, 2009 by bmueller Link to comment Share on other sites More sharing options...
wraithdu Posted February 20, 2009 Share Posted February 20, 2009 Same problem. Here's a possible solution, not pretty, but it works. Opt("MouseCoordMode", 2) Run ("RunDll32.exe shell32.dll,Control_RunDLL desk.cpl") WinWait("[CLASS:#32770; TITLE:Display Settings]") $hwnd = WinGetHandle("[CLASS:#32770; TITLE:Display Settings]") $chwnd = ControlGetHandle("Display Settings", "", "Monitor322") $cpos = ControlGetPos($hwnd, "", $chwnd) WinActivate($hwnd) MouseMove($cpos[0] + 5, $cpos[1] + 5, 0) MouseClick("left") Link to comment Share on other sites More sharing options...
bmueller Posted February 20, 2009 Author Share Posted February 20, 2009 works like a charm. Thanks Link to comment Share on other sites More sharing options...
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