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
712 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

689 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