knightr1701
Technical User
I am trying to make a HTA script to open windows functions through a button environment. Example is I want to open some control panel windows, msconfig, and command line prompts like ipconfig /release. I don't need a complex script just simple. But my problem is that I can't get certian control panel items to open or programs like system restores exe rstrui.exe but i get a error that rstrui.exe can't be found or msconfig can't be found. I am including the script. thanks for any help. Everything is working below except case line 20 and rstrui.exe wich I removed for the moment because it doesn't work.
Code:
<HTML>
<HEAD>
<TITLE>Kelly's Control Panel</TITLE>
<OBJECT ID="oShell"
CLASSID="clsid:13709620-C279-11CE-A49E-444553540000">
</OBJECT>
<STYLE>
INPUT {width: 200}
</STYLE>
<SCRIPT LANGUAGE="VBScript">
<!--
function fnStart(sMethod)
select case sMethod
case 0
'Minimizes all windows on the desktop
oShell.MinimizeAll
case 1
'Displays the Run dialog box
oShell.FileRun
case 2
'Displays the Programs and Features dialog box
oShell.ControlPanelItem "appwiz.cpl"
case 3
'Displays the Services dialog box
oShell.ShellExecute "services.msc"
case 4
'Displays the Date/Time dialog box
oShell.SetTime
case 5
'Displays the Internet Properties dialog box
oShell.ControlPanelItem "INETCPL.cpl"
case 6
'Displays the Device Manager dialog box
oShell.ShellExecute "devmgmt.msc"
case 7
'Displays the Disk Cleanup dialog box
oShell.ShellExecute "cleanmgr"
case 8
'Opens the Users Folder
oShell.ShellExecute "c:\users"
case 9
'Displays the Taskbar Properties dialog box
oShell.TrayProperties
case 10
'Displays the Windows Update dialog box
oShell.ShellExecute "wuapp.exe"
case 11
'Displays the Command Prompt dialog box
oShell.ShellExecute "cmd"
case 12
'Displays the Full Control Panel dialog box
oShell.ShellExecute "control"
case 13
'Displays the Disk Management dialog box
oShell.ShellExecute "diskmgmt.msc"
case 14
'Displays the Screen Resolution dialog box
oShell.ControlPanelItem "desk.cpl"
case 15
'Displays the Event Viewer dialog box
oShell.ShellExecute "eventvwr.msc"
case 16
'Displays the Power Configuration dialog box
oShell.ControlPanelItem "powercfg.cpl"
case 17
'Displays the Registry Editor dialog box
oShell.ShellExecute "regedit"
case 18
'Displays the System properties dialog box
oShell.ControlPanelItem "sysdm.cpl"
case 19
'Displays the Action Center dialog box
oShell.ControlPanelItem "wscui.cpl"
case 20
'Displays the Msconfig dialog box
oShell.ShellExecute "msconfig"
end select
end function
-->
</SCRIPT>
</HEAD>
<BODY>
<H1>Control Panel Shortcuts</H1>
<INPUT type="button" value="MsConfig" onclick="fnStart(20)">
<INPUT type="button" value="Action Center" onclick="fnStart(19)"><br>
<INPUT type="button" value="System Properties" onclick="fnStart(18)">
<INPUT type="button" value="Reg Edit" onclick="fnStart(17)">
<INPUT type="button" value="Power Configuration" onclick="fnStart(16)">
<INPUT type="button" value="Event Viewer" onclick="fnStart(15)">
<INPUT type="button" value="Screen Resolution" onclick="fnStart(14)"><br>
<INPUT type="button" value="Disk Management" onclick="fnStart(13)">
<INPUT type="button" value="Full Control Panel" onclick="fnStart(12)">
<INPUT type="button" value="Command Prompt" onclick="fnStart(11)">
<INPUT type="button" value="Windows Update" onclick="fnStart(10)">
<INPUT type="button" value="Edit Taskbar Properties" onclick="fnStart(9)"><br>
<INPUT type="button" value="Users Accounts Folder" onclick="fnStart(8)">
<INPUT type="button" value="Disk Cleanup" onclick="fnStart(7)">
<INPUT type="button" value="Device Manager" onclick="fnStart(6)">
<INPUT type="button" value="Modify Internet Properties" onclick="fnStart(5)">
<INPUT type="button" value="Set System Time" onclick="fnStart(4)"><br>
<INPUT type="button" value="Services" onclick="fnStart(3)">
<INPUT type="button" value="Programs and Features" onclick="fnStart(2)">
<INPUT type="button" value="Run" onclick="fnStart(1)">
<INPUT type="button" value="Minimize All Windows" onclick="fnStart(0)">
</BODY>
</HTML>