jjmiller Posted July 17, 2010 Share Posted July 17, 2010 (edited) So I'm trying to write a script that will disable one of my monitors. I'm running an nVidia video card, and the nVidia Control Panel software has a function to set up different profiles. I'm trying to write a script that will open the nVidia Control Panel, load the profile, then close the nVidia Control Panel. The problem is, halfway through the scrip, it just seems to die. Here's my script; Open the nVidia control panel Run("nvcplui.exe") ; Once the control panel is open, send a control+P and control+L for Profile > Open WinWaitActive("NVIDIA Control Panel") Sleep(1500) Send("!p") Send("l") ; Once the "Load Desktop Profile" dialog box is open, type the profile name into ; the text box and hit <ENTER> Sleep(100) WinWaitActive("Load Desktop Profile") Send("single_display.nvp") Send("{ENTER}") ; Confirmation box will come up asking if you're sure. Defaults to "Yes", so hit enter Sleep(2000) ;WinWaitActive("NVIDIA Control Panel", "Loading this profile will replace") Send("!y") ;ControlClick("NVIDIA Control Panel", "", "[CLASS:Button; TEXT:&Yes; INSTANCE:1]") ;Send("{ENTER}")This isn't the whole script, but this is where it dies. I get to this window:And for some reason I can't get it to click the "Yes" button. As you can see from the commented out lines in my script above, this is what I've tried:Hitting {ENTER}(as you can see in the picture, it defaults to "Yes" being active"Sending Alt+Y to hit "Yes"Putting a delay on it to give the window time to open, then hitting {ENTER} or Alt+YHaving it click the Yes buttonHitting the {TAB} button twice to highlight "No" then "Yes", then hitting {ENTER}I've tried all of the above while using the "WinWaitActive" command or just waiting for several seconds to make sure the window has time to pop up, or doing both. What is happening is that when it gets to the dialog box shown in the screen shot above, the window just disappears] as if I either hit "No" or just closed the window. This is driving me nuts, I appreciate any help anybody can offer.Thanks Edited July 17, 2010 by jjmiller Link to comment Share on other sites More sharing options...
RogerRabbitsClone Posted July 17, 2010 Share Posted July 17, 2010 (edited) try sleep (2000) winactivate ("NVIDIA Control Panel", "Loading this profile will replace") send ("!y")or mouseclick i know mouse click is kinda sloppy, but i dont see why it wouldnt work Edited July 17, 2010 by RogerRabbitsClone <--a good way to start you day Link to comment Share on other sites More sharing options...
LordBlackout Posted July 18, 2010 Share Posted July 18, 2010 It's possible that the nVidia window pauses the script? Link to comment Share on other sites More sharing options...
JohnOne Posted July 18, 2010 Share Posted July 18, 2010 (edited) Try; Open the nVidia control panel Run("nvcplui.exe") ; Once the control panel is open, send a control+P and control+L for Profile > Open $NVCP = WinWait("NVIDIA Control Panel"); get the window handle Winactivate($NVCP) WinWaitActive($NVCP) ;Sleep(1500) Send("!p") Send("!l") ; if this is meant to be control+1 ; Once the "Load Desktop Profile" dialog box is open, type the profile name into ; the text box and hit <ENTER> Sleep(100) WinWaitActive("Load Desktop Profile") Send("single_display.nvp") Send("{ENTER}") ; Confirmation box will come up asking if you're sure. Defaults to "Yes", so hit enter Sleep(2000) ;WinWaitActive("NVIDIA Control Panel", "Loading this profile will replace") Send("!y") ;ControlClick("NVIDIA Control Panel", "", "[CLASS:Button; TEXT:&Yes; INSTANCE:1]") ;Send("{ENTER}") Edited July 18, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jjmiller Posted July 25, 2010 Author Share Posted July 25, 2010 So I've tried both of the methods above with no luck. The mouseclick almost worked, except that the window seems to not always open in the same place, so I can't give it any good coordinates. The method that JohnOne suggested gave me the same results I've been getting.I'm starting to wonder if LordBlackout is right and nVidia is doing something that stops the script, though I can't imagine why they'd do that. Any other ideas? Link to comment Share on other sites More sharing options...
Developers Jos Posted July 25, 2010 Developers Share Posted July 25, 2010 Show us what au3info tells you about the popup window and add some debugging to your script to make sure you know what line it is at when the popup windows is shown. This is one option at your disposal:Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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