View Full Version : Launching an external application
QuackHead
08-11-2003, 05:37 PM
I'm wondering if it's possible to lauch a file from ASP and pass it a command line parameter...
I'm looking for something similar to the VB SHELL function.
I know the path/name of the application on the user's computer (this is for internal use only)... and I'd like to be able to run that program from a website.
Any ideas?
Thanks
~Quack
Roy Sinclair
08-11-2003, 06:32 PM
Sorry but that's a no-go from a web page, even an internal web page. The only way you can do this is it's a web page that's local to the user's own computer.
QuackHead
08-11-2003, 06:44 PM
That's an option, we would install the html (or whatever) page on the user's computer.
How now brown cow? (sorry... I had to)
let me know
~Quack
Roy Sinclair
08-11-2003, 08:00 PM
If you install it to the user's computer name it pagename.hta which will make it a HTML application, then you get full capabilities to do all the things you can't do otherwise, things like change the chrome on an open window, run applications and much more.
QuackHead
08-11-2003, 08:40 PM
Can you give me an example code?
Just make up a fake application name and pass a parameter to it...
Thanks
~Quack
Roy Sinclair
08-11-2003, 10:07 PM
Overview:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie50/html/ie5hta.asp
http://www.microsoft.com/mind/0799/htmlapps/htmlapps.asp
Reference:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/reference/hta_ref_entry.asp
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/hta_node_entry.asp
More Specific (the Shell object):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/objectmap.asp
One of the abilities of the Shell object is to launch applications.
QuackHead
08-11-2003, 10:18 PM
Thanks Roy
QuackHead
08-19-2003, 09:51 PM
Ok.. i've looked at the examples and all.. but I can't seem to get this to do what I want it to...
here's the example of how I would do it in VB
x = Shell("c:\windows\Explorer.exe c:\windows\system32", vbNormalFocus)
As you can see, I'm opening a file, and passing a command line parameter to it.
I need to be able to do this from ASP, or HTML/HTA... can someone please give me a FULL example of how to do this?
~Quack
Roy Sinclair
08-19-2003, 10:29 PM
Example (must be run as a .HTA) using Javascript:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Testing</title>
<script language="javascript" type="text/javascript">
var shellObject = new ActiveXObject("Shell.Application");
function StartThis(CommandToRun)
{
shellObject.open(CommandToRun)
}
</script>
</head>
<body>
<a href="#" onclick="StartThis('c:\\winnt\\notepad.exe');">Start NotePad</a>
<br />
</body>
</html>
arnyinc
08-19-2003, 10:33 PM
<HTML>
<HEAD>
<TITLE>Start Page</TITLE>
<OBJECT ID="oShell"
CLASSID="clsid:13709620-C279-11CE-A49E-444553540000">
</OBJECT>
<STYLE>
INPUT {width: 200}
</STYLE>
<SCRIPT LANGUAGE="VBScript">
function fnStart()
oShell.Explore "C:\oracle"
end function
</SCRIPT>
</HEAD>
<BODY>
<H1>Start...</H1>
<INPUT type="button" value="Lookie here" onclick="fnStart()">
</BODY>
</HTML>
QuackHead
08-19-2003, 11:03 PM
I still do not see any examples of anyone passing a command line parameter to the application to be run.
x = Shell("c:\windows\Explorer.exe c:\windows\system32", vbNormalFocus)
As you can see, I'm opening a file, and passing a command line parameter to it.
Please, just use my example and make it work from an .HTA file (I guess... if you have another way of doing it, by all means, post.)
Thanks guys
~Quack
QuackHead
08-20-2003, 03:19 PM
Anyone got something for me?
Roy Sinclair
08-20-2003, 04:30 PM
Everything works ok and I can run any program until I try to add a parameter to pass to the program, then it just silently ignores the command.
Gonna have to search further...
QuackHead
08-21-2003, 04:27 PM
Has anyone found anything to answer this yet? I myself have been searching and still can't figure it out...
Roy Sinclair
08-28-2003, 09:09 PM
Saw another thread that lead to to the right ActiveX object.
http://www.codingforums.com/showthread.php?s=&threadid=25453
The following code works:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<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>
<a href="#" onclick="StartThis(notepad.exe c:\\boot.ini');">Start NotePad</a>
<br />
</body>
</html>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.