Click to See Complete Forum and Search --> : Run Program Function


Farnborough
10-29-2003, 10:24 AM
I am using the below code on an intranet site. The javascript drop down menu functions fine and runs the relevant programs.

The second onclick command gives a script error - 'missing')'' and I cannot see why.

<script type="text/javascript">

fso = new ActiveXObject("Scripting.FileSystemObject");

function RunProgram(Program_Path) {
Default_Value = Program_Path.match(new RegExp("Default", "i"))
if (Default_Value) {
} else {
new ActiveXObject("WScript.Shell").Run(Program_Path,3,false)
}
}

</script>
<select onchange="RunProgram(this.value)">
<option value="Default" selected>Launch EMIS/MENTOR</option>
<option value="C:\\progra~1\\mentor~1\\mentor.exe">MENTOR</option>
<option value="C:\\progra~1\\lv2\\lv.exe">EMIS</option>
</select>


<td rowspan="3"><A href="javascript:// "onclick="RunProgram(C:\\progra~1\\mentor~1\\mentor.exe)"><img name="access_page_allstaff_r8_c6" src="../grph_files/sliced_images/access_page_allstaff_r8_c6.gif" width="93" height="51" border="0" alt=""></a></td>
<td><img src="../grph_files/sliced_images/spacer.gif" width="1" height="6" border="0" alt=""></td>
</tr>


Can anyone help me please?

Thank you

gil davis
10-29-2003, 10:43 AM
<A href="javascript:// "onclick="RunProgram(C:\\progra~1\\mentor~1\\mentor.exe)">
Try this instead:
<A href="#" onclick="RunProgram('C:\\progra~1\\mentor~1\\mentor.exe');return false">

Farnborough
10-29-2003, 11:05 AM
Thanks, that worked just fine.