Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Fri Dec 05, 2008 1:50 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Launch program from html page
PostPosted: Wed Feb 21, 2007 6:46 pm 
Offline

Joined: Tue Feb 20, 2007 12:07 pm
Posts: 1
I need your help, can you !!!
:oops:


I am trying to launch a program that residents in C drive (I mean that the path of the program will not change, it will be always the same) from html page. So that if the user clicks on the link, the program that is stored in the user's computer should start. I have tried to run programs with exe extension and another one with TBK extension. Below is the javascript code that I used. I got it from another forum.

<html>
<head>
<title>Exe</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">
/*
Copyright (c) 2005 VK [schools_ring_at_yahoo.com]
Permission is hereby granted, free of charge, to any person obtaining
a copy
of this software and associated documentation files (the "Software"),

to deal in the Software without restriction, including without
limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished
to do so, subject to the following conditions:</p>
The above copyright notice and this permission notice shall be
included in
all copies or substantial portions of the Software.</p>
THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY
KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY

CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

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) {
if ((typeof path == 'string') && (path != '')) {
if ((Shell.MSIE) && (typeof Shell.$ == 'undefined')) {
try {Shell.$ = new ActiveXObject('WScript.Shell');}
catch(e) {Shell.$err(e.message);}
}
if (Shell.MSIE) {
try {Shell.$.Run(path);}
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) ;
/* NOTE: initWithPath has problems on MacOS and other OSes
* which do not represent file locations as paths.
* If you do use this function, be very aware of this problem!
*/
Shell.$.initWithPath(path);
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:\\Program Files\\WinZip\\WINZIP32.EXE'));">Launch EXE</a>
</p>
</body>
</html>


I have used WinZip as a example.
Now, if I run this code locally from my machine it will run only exe program with IE, but not the TBK. However, Netscape will run the two types of the extension. Honestly, IE is more important to me. Another problem is that If I upload the page to server, neither IE nor Netscape are able to run the programs. Can anybody help me with that. Honestly, this is the first time I run JavaScript code!!! :oops: :oops:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: