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
695 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now