I need to start various applications from javascript. I found a solution (see code below), but it has two problems:
-- The javascript uses an activeX object, so when the user opens the page, they receive an ActiveX warning and have to click OK to continue. QUESTION: Is there any way to suppress the warning?
-- If the application's path has spaces in it, then the app won't start. QUESTION: How do I overcome this issue?
Thanks!
Code follows:
-- The javascript uses an activeX object, so when the user opens the page, they receive an ActiveX warning and have to click OK to continue. QUESTION: Is there any way to suppress the warning?
-- If the application's path has spaces in it, then the app won't start. QUESTION: How do I overcome this issue?
Thanks!
Code follows:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html>
<head>
<title>Testing</title>
<script language="javascript" type="text/javascript">
var shellObject = new ActiveXObject("wscript.Shell");
function StartThis(CommandToRun)
{
shellObject.run(CommandToRun)
}
</script>
</head>
<body>
<font face="Arial" size="2">
<a href="#" onclick="StartThis('c:\\windows\\notepad.exe');">Start NotePad</a>
<p><p>
<a href="#" onclick="StartThis('c:\\program files\\textpad 4\\textpad.exe');">Start TextPad</a>
</font>
</body>
</html>