Solved

Launch an EXE file that is on a CD-ROM from an HTA Application that is on the same CD-ROM

Posted on 2003-11-18
2
701 Views
Last Modified: 2010-04-09
Hi!

I am trying to launch an EXE file (Director.exe) from my HTA Application - "Default.hta" (which is on the same CD-ROM). I am using the following WSH code:

---------------------------

<script language="VBScript">
Dim objShell
Sub Run(Name)
  Set objShell = CreateObject("WScript.Shell")
  objShell.Run Name
  On Error Resume Next
  Set objShell = Nothing  
End Sub
</script>

<!-- Launch File -->
<font onClick="javascript:Run('Director.exe');" style="cursor: hand;"><u>Run Macromedia Director File</u></font>

----------------------------------

If I place the Director.exe file on the hard drive and Javascript link to "C:/Director.exe" The program runs fine. But when I try to link to it on the CD-ROM (as in the above example) I get the following error:

ERROR: The System cannot find the file specified
CODE: 0
URL: File://E:\default.hta

Any thoughts??

AMCStephen
0
Comment
Question by:amcstephen
2 Comments
 
LVL 11

Accepted Solution

by:
Zontar earned 300 total points
ID: 9777823
<font onClick="javascript:Run('Director.exe');" style="cursor: hand;">

????? This is just *so* wrong. PLEASE get rid of that font tag -- that's just too horrid to describe. I feel like a bird hypnotised by a snake -- I can't quit looking at it in amazment that someone would actually write something like that. Not JUST a font tag, but one containing an event handler and an inline style. *shudder*

Anyway... It appears that something's not happy with the path you're giving to the Director.exe file and looks like it'd be much happier with an absolute path. Is that file in the same directory as your HTA?

What you might be able to do is to use self.location.href to figure out the correct path to the HTA file, and then you can fix the path to the .exe from there.

self.location.href in a local file should return something like "file:///G:/dirname/page.html". You can get the drive letter from that, and the rest of the path should be easy to put together.
0
 
LVL 31

Assisted Solution

by:seanpowell
seanpowell earned 200 total points
ID: 9778719
So , you're sayign you don't like the font tag link ;-)

Perhaps
<head onClick="javascript:Run('Director.exe');" style="cursor: hand;">... would be better?

Just kidding... I'm not up on all the syntax, but I was under the impression that the hta exec command had to look something like:

var Shell = new ActiveXObject("WScript.Shell");
Shell.Run("file:///E|/director.exe");
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
html input type 3 31
Easy responsive table out of existing table 28 55
Changing alignment and creating border 6 27
One field not displaying content (ASP Classic) 8 23
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question