Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
721 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 600 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 400 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

636 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