Reputation: 9816
I have this hta script and when i run it i get an error saying "RunFile1 is not defined"can any one help me fix this. Thanks.
My code:
<body background = "Image.png">
<TITLE>Test GUI</TITLE>
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script>
<script type="text/javascript" language="javascript">
function RunFile2() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/cmd.exe", 1, false);
}
</script>
<script type="text/javascript" language="javascript">
function RunFile3() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/regedit.exe", 1, false);
}
</script>
<script type="text/javascript" language="javascript">
function RunFile4() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("H:\MY GUI 2.hta", 1, false);
}
</script>
<input type="button" value="Option 1 (notepad.exe)" name="run_button" onClick="RunFile()"><p>
<input type="button" value="Option 2 (cmd.exe)" name="run_button" onClick="RunFile2()"><p>
<input type="button" value="Option 3 (regedit.exe)" name="run_button" onClick="RunFile3()"><p>
<input type="button" value="Option 4"(hta-file.hta)" name="run_button" onClick="RunFile4()"><p>
<input type="button" value="Option 5" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 6" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 7" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 8" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 9" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 10" name="run_button" onClick="TestSub"><p>
</body>
Thanks for any help.
Upvotes: 0
Views: 330
Reputation: 23406
You've functions RunFile(), RunFile2(), ... RunFile4()
, but not RunFile1()
. You'll get also an error from RunFile4()
, you need to escape backslashes and wrap a space(s)-containing string into double quotes, i.e. the first argument in Run()
should be '"H:\\MY GUI 2.hta"'
.
Upvotes: 2