Click here to get back home

Problems starting application on machine with HTML page

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Problems starting application on machine with HTML page kevin.a.sweeney 04-25-2007
Get Chitika Premium
Posted by kevin.a.sweeney on April 25, 2007, 1:18 pm
Please log in for more thread options


I would like to open an application from a hyperlink on a webpage.

1. the webpage is located on my local machine.
2. the application is located on my local machine.
3. the application will run on my local machine.

In other words... The WEB is really not involved.

What I have so far works with a Netscape Browser but what I really
need is for it to work in the IE browser or one that I will create
using
VB.net.

The code I have so far uses JAVAscript and some simple HTML code.

The code is as follows:

<html>
<head>
<title>Application launcher</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">


var Shell = {
'$err' : function(m) {
var msg = m || 'Security exception';
window.alert('[Shell] script object\n\n' + msg);
}
, 'MSIE' : ( (typeof window != 'undefined')
&& (typeof window.ActiveXObject != 'undefined'))

, 'Gecko' : ( (typeof window != 'undefined')
&& (typeof window.netscape != 'undefined')
&& (typeof window.netscape.security != 'undefined')
/* that Opera... always pretending to do everything
* everywhere but not really doing anything of it...
*/
&& (typeof window.opera != 'object'))
, 'run' : function(path, args) {
if ((typeof path == 'string') && (path != '')) {
if ((Shell.MSIE) && (typeof Shell.$ == 'undefined')) {
/* If first time, try to instantiate ActiveX object
* for shell access:
*/
try {
Shell.$ = new ActiveXObject('WScript.Shell');
}
catch(e) {
Shell.$err(e.message);
return null;
}
}
/*
*/
if (Shell.MSIE) {
var arg = ((typeof args == 'string') && (args != '')) ?
(' "' + args + '"') : '';
var exe = '"'.concat(path, '"', arg);
try {
Shell.$.Run(exe);
}
catch(e) {
Shell.$err(e.message);
}
}
else if (Shell.Gecko) {
/* Netscape security model grants privileges
* on the per-call per-context basis; thus
* privilege request and privilege usage
* have to be in the same block.
*/
try {
netscape.security.PrivilegeManager.
enablePrivilege('UniversalXPConnect');
Shell.$ = Components.classes['@mozilla.org/file/local;1'].
createInstance(Components.interfaces.nsILocalFile);
Shell.$.initWithPath(path);
if ((typeof args == 'string') && (args != '')) {
Shell._ = Components.classes['@mozilla.org/process/util;1'].
createInstance(Components.interfaces.nsIProcess);
Shell._.init(Shell.$);
Shell._.run(false, [args], 1);
}
else {
Shell.$.launch();
}
}
catch(e) {
Shell.$err(e.message);
}
}
else {
Shell.$err('not supported on this platform');
}
}
else {
Shell.$err('Invalid argument');
}
}
};

</script>
</head>
<body>
<p>
<a href="javascript:void(Shell.run('c:\windows\notepad.exe', 'c:\
\netlog.txt'));">launch Notepad with netlog.txt</a><br>
<a href="javascript:void(Shell.run('c:\windows\notepad.exe', 'c:\
\myfile.txt'));">launch Notepad with myfile.txt</a><br>
</p>
</body>
</html>


I know I have some syntax problems but I am really stumped as to
where.

Any help would be appreciated.

Kevin


Posted by Jonathan N. Little on April 25, 2007, 2:58 pm
Please log in for more thread options


kevin.a.sweeney@gmail.com wrote:
> I would like to open an application from a hyperlink on a webpage.
>
> 1. the webpage is located on my local machine.
> 2. the application is located on my local machine.
> 3. the application will run on my local machine.
>
> In other words... The WEB is really not involved.
>
> What I have so far works with a Netscape Browser but what I really
> need is for it to work in the IE browser or one that I will create
> using
> VB.net.
>

Hmmm this is comp.infosystems.www.authoring.html
^^^
Won't some Microsoft group be better suited?

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Similar ThreadsPosted
Problems Starting an Ordered List at Zero September 24, 2004, 2:33 pm
How my html pages looks like in Apple machine? August 9, 2004, 3:00 am
Web page served as application/xhtml+xml November 24, 2008, 3:51 pm
mailto works on my machine August 26, 2004, 5:26 pm
something that logs incoming machine name October 29, 2004, 1:10 am
i've a frame that to render its content on on machine July 14, 2005, 9:36 pm
problems validating my page November 4, 2004, 1:46 pm
Starting a blog - what do I do about feeds? December 26, 2007, 11:32 pm
Starting a video from a particular place July 17, 2008, 2:56 pm
howto randomise starting pic in slideshow? February 3, 2005, 11:44 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap