I am trying to write a script that will open the computer name changes
window in the system control panel. A friend gave the following:
Option Explicit
Dim oWS
Set oWS = WScript.CreateObject("WScript.Shell")
WScript.Sleep 5500
'Bring up the System Properties window
oWS.run "rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1"
WScript.Sleep 1000
'Bring up the computer name changes window
oWS.SendKeys "%c"
WScript.Sleep 1000
oWS.SendKeys "%d"
WScript.Sleep 1000
oWS.SendKeys "{Tab}"
WScript.Sleep 500
oWS.SendKeys "test.local"
WScript.Sleep 500
oWS.SendKeys "{ENTER}"
Set oWS = nothing
The problem is the system properties window loses focus and the rest of the
commands don't register. Is there a way to directly bring up the computer
name changes window? Or is there a way to make the System Properties window
the focus?
Thanks,
Jason