Sign in to follow this  
Followers 0
Arrrghmatey

open external programs from browser?

5 posts in this topic

Hello,

I have a program that reads information from a file, and dumps it into a HTML table, then opens the file in IE. I want to be able to have the name of the file a click-able link, where it opens that file in a specific program. Because this is not the default program to open this file type, I cannot figure out how to open it with the specific client side program. Is this possible at all?

Thanks!

Share this post


Link to post
Share on other sites



This is what I'm using right now:

<script>
function LaunchApp() {
 if (!document.all) {
  alert ("Available only with Internet Explorer.");
  return;
 }
 var ws = new ActiveXObject("WScript.Shell");
 ws.Exec("C:\\Program Files\\ezdicom\\StandAlone\\ezDicom.exe");
}
</script>
<a href="javascript:LaunchApp()">Launch the executable</a>

But it launches the program. I can't seem to figure out how to launch a FILE in the program... Ideally I won't have to install anything, as this will be ported around to other computers here.

Share this post


Link to post
Share on other sites

What I did when I had to launch an app from IE was to have the link pop up a specific message box and then when AutoIt saw the message box, it would launch the app and the file using the Run() command. A pop-up like "Please wait while Word loads" or something similar works nicely. However, I am pretty low-tech in my scripts so I am sure there are better ideas out there.

Share this post


Link to post
Share on other sites

I figured out a solution. I was using " where I should have been using '.

in case anyone else wants it, here's my code:

<script
  LANGUAGE="javascript"
  TYPE="text/javascript"
>
function PROCTest(imgPath) {
var path = '\"C:\\Program Files\\example\\example.exe\" ' + '\"' + imgPath + '\"';
 var myshell = new ActiveXObject( "WScript.shell" );
 myshell.run( path, 1, true );
}
</SCRIPT>
<!------------------------------------------------------------------->
<a href="javascript:PROCTest('C:\\5H3QM0AC')">Launch the executable</a>

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0