I am trying to code a page for an internal website that will generate a list of files and display them on an ASP page. I have this portion of the code working.

I am trying to load an HTA page to run an executable with a parameter of whichever file a user clicks on from the ASP page. I am passing the variable (I think!!!) to the HTA page via: <A HREF=http://server/main.hta?file=filename.ext></A> .

My HTA page attempts to run the executable with a parameter of "file", but I can't get this part to work.

Is there a better way to do this? I am new to scripting, so please excuse my ignorance!

And thanks in advance!!

Please help! If I need to post more information, please let me know what I need to post! Thanks!

Here's the code I have written. I've tried combining the code into this ASP file, as I read on here that you can't exactly pass a parameter from an ASP file to a client-side file, such as HTA. Any help you can provide is appreciated!

<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>
<script language="vbscript">

function PROCRun('File.Name'){

 var shell = new ActiveXObject("WScript.Shell")
 shell.run( '"C:/Program Files/videolan/vlc/vlc.exe" "//server/files/' & File.Name & '"', 1, false )
 window.close()
}
</script>
</head>

<body>
<FONT SIZE=20>
    
<%@ LANGUAGE = VBScript %>

<% 
 Set FileObject = CreateObject("Scripting.FileSystemObject")
 Set Folder = FileObject.GetFolder(Server.Mappath("./"))
 Set Files = Folder.Files
 
 For Each file in Files
  If File.Name <> "default.asp" Then
    If File.Name <> "main.hta" Then
    
    Response.Write "<font size=20><CENTER><A HREF=vbscript:PROCRun('File.Name')>" & File.Name & "</A></CENTER></font>" 

& Chr(13)
    
    End If
  End If
 Next

%>

</font>
</body>

</html>
This article has been dead for over six months. Start a new discussion instead.