running files locally?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

gurutech

Thread Starter
Joined
Apr 23, 2004
Messages
2,960
I have an intranet site where I am trying to have a page (asp, html, hta - whatever...) load that will run an executable file on the client machine. Reason for this is that the executable is located on the client machine, and I don't want the client to have to "download" the executable each time the item is clicked, as the executable needs to be run with different parameters, based on a list of files that are located in a specific directory.

ie: "C:\windows\notepad.exe filename.ext"

I am trying to run a different executable than what is defined in the "File Types" (ie, I am trying to load a non-txt file in a program such as notepad).
 
Joined
Jul 29, 2004
Messages
6,650
Finally, I got what you want exactly in your former thread !

How to proceed
---------------
1° For each application that must be executed on the client computer, create a VB script with the appropriate shell command and save it in a directory under the name vbrun_X.vbs where X is a number ( vbrun_0.vbs for the first, vbrun_1.vbs for the second and so on ...).

2° I've adapted the coding you posted in your previous thread :

Code:
[SIZE=2]
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Movies</title>
[COLOR=Blue]<SCRIPT Language="Javascript">
function button(number)
{
   parent.location.href='http://123.123.123.123:8080/yourVBdirectory/vbnum_' + number + '.vbs';
}
</SCRIPT>[/COLOR]
</head>
<body>
<FONT SIZE=20>
<%@ LANGUAGE = VBScript %>
<%
[COLOR=Blue]Dim increment as Integer
increment = 0[/COLOR]
Set FileObject = CreateObject("Scripting.FileSystemObject")
Set Folder = FileObject.GetFolder(Server.Mappath("./"))
Set Files = Folder.Files
Response.Write "<B><CENTER>Movies</CENTER></B>" & Chr(13)
Response.Write "<Form>"
For Each file in Files
If File.Name <> "default.asp" Then
[COLOR=Blue]Response.Write "<input type='button' value='" & File.Name & "' OnClick='button(" & increment & ")'><BR>" & Chr(13)
increment = increment + 1[/COLOR]
End If
Next
Response.Write "</FORM>"
%>
</font>
</body>
</html>
[/SIZE]
3° Also, don't forget to adapt the URL in the Javascript function.
 

gurutech

Thread Starter
Joined
Apr 23, 2004
Messages
2,960
Perfect! (with exceptions, of course!) I've adapted your script to "call" an HTA file called " & File.Name".hta, and placed the HTA files into a subfolder called HTA (so the HTA files themselves won't show up in the list generated by the ASP code.

The only issue I am having now is when I click on the link, it asks me if I want to "run" or "save" the HTA file. This is not a big deal, but if you know a way around it, I am more than willing to listen!

Here's my code:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Movies</title>

</head>

<body>
<FONT SIZE=20>

<%@ LANGUAGE = VBScript %>

<%
Set FileObject = CreateObject("Scripting.FileSystemObject")
Set Folder = FileObject.GetFolder(Server.Mappath("./"))
Set Files = Folder.Files

Response.Write "<BR><B><CENTER>Movies</CENTER></B>" & Chr(13)

For Each file in Files
If File.Name <> "default.asp" Then

Response.Write "<CENTER><A HREF=./hta/" & File.Name & ".hta>" & File.Name & "</A></CENTER>" &

Chr(13)

End If
Next

%>

</font>
</body>

</html>
 
Joined
Jul 29, 2004
Messages
6,650
.hta files must be executed by the Microsoft (R) HTML Application host and not by Internet Explorer.
Also, if you see that .hta files are tagged with an IE icon, then you have to make it open by the above application (right click on a .hta file then select 'Open with' and so on).
 

gurutech

Thread Starter
Joined
Apr 23, 2004
Messages
2,960
Yes, they are opening with the HTML App Host. Just wondering if there was a way to make it so I didn't have to click "Run" when the security window comes up.
 
Joined
Jul 29, 2004
Messages
6,650
Good question !
I thought HTML App Host was automatically triggered when the link to the hta file is clicked.
I guess there's no way to avoid the dialog box for security reasons.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top