DeathKnight Posted February 29, 2004 Share Posted February 29, 2004 I'm using VBscript do to certain settings that can't be done with the registry.. But I ran into some problems with slower machines. The problem was that the script can't know if a control panel is already loaded.I kinda got around that. This is my code for setting best peformane in a dutch windows XPSub DoAction(str, ms) 'Check status until ready status = (WshShell.AppActivate)(cPanel.ProcessID) Do Until status = true WScript.Sleep 1000 status = (WshShell.AppActivate)(cPanel.ProcessID) WScript.Sleep 1000 Loop if status = true then WshShell.SendKeys str WScript.Sleep ms End ifEnd Sub'Set windows for best performance Set WshShell = CreateObject("WScript.Shell") Set cPanel = WshShell.Exec("rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3") status = (WshShell.AppActivate)(cPanel.ProcessID) Do Until status = true WScript.Sleep 500 status = (WshShell.AppActivate)(cPanel.ProcessID) WScript.Sleep 500 Loop if status = true then DoAction "%I", 200 DoAction "%P", 500 DoAction "%T", 200 DoAction "{ENTER}", 200 DoAction "{ESC}", 200 End if WScript.Sleep 1000This way the code waits for the control panel to be loaded.. It took me a few hours to get it working just the way I wanted it too. But this might come in handy for other users. 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