Jump to content

Recommended Posts

Posted

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 XP

Sub 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 if
End 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 1000

This 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.


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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...