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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Issue in webpage 6 34
SCRIPT65535: Unexpected call to method or property access video html 5 explorer 3 46
Centering Vertically 3 28
Alignment is not working correctly. 8 32
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

920 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

14 Experts available now in Live!

Get 1:1 Help Now