Ahh... the lightbulb comes on over here finally!
I looked at your
index.htm and briefly at your script includes as well. I wasn't sure WHAT was going on for a bit!
Then I reread your initial post in this thread.
I think you are under a series of misconceptions here, but the most fundamental one is to think HTTP can function as a transparent Windows file system.
Script on a client page cannot read or write files on the web server. At
best your client script might read/write files on the client system, and only
then if the right security options are set on the user's browser and the user authorizes the use of unsafe ActiveX components when warned about them.
And you sure as heck can't run a program located on a web server from client script. At best you might have a user download an installer package, install it, and then run it locally. Once installed locally the script might even be able to run it locally. Of course you still have the ActiveX security hurdles (already described) to overcome.
Code like this:
Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBSCRIPT">
Dim WshShell, FSO, ProcEnv
Set WshShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set ProcEnv = WshShell.Environment("Process")
Sub Report(strProgress)
txtProgress.value = txtProgress.value & strProgress & vbCrLf
End Sub
Sub btnGo_onclick
Dim strEnvTemp, strName, streamIO, strCommand, strData
txtProgress.value = ""
txtOutput.style.visibility = "hidden"
txtOutput.value = ""
strEnvTemp = ProcEnv("TEMP")
If ProcEnv("OS") = "" Then
strCommand = "command" 'Win 9x family
Else
strCommand = "cmd" 'Win NT family
End If
strName = strEnvTemp & "\" & CStr(Int(Rnd * 10000000))
Report "Creating initial file " & strName & ".raw"
Set streamIO = FSO.CreateTextFile(strName & ".raw", True) ' True = Overwrite
streamIO.WriteLine "walrus"
streamIO.WriteLine "zebra"
streamIO.WriteLine "elephant"
streamIO.WriteLine "aardvark"
streamIO.Close
Set streamIO = Nothing
Report "Sorting data"
WshShell.Run strCommand & " /C sort " & strName & ".raw >" & strName & ".srt", 0, True
Report "Reading sorted file " & strName & ".srt"
Set streamIO = FSO.OpenTextFile(strName & ".srt", 1) ' 1 = ForReading
While Not streamIO.AtEndOfStream
strData = streamIO.ReadLine
txtOutput.value = txtOutput.value & strData & vbCrLf
Wend
streamIO.Close
Set streamIO = Nothing
txtOutput.style.visibility = "visible"
Report "Cleaning up"
FSO.DeleteFile strName & ".raw"
FSO.DeleteFile strName & ".srt"
Report "Complete"
End Sub
</SCRIPT>
</HEAD>
<BODY>
<INPUT ID="btnGo" TYPE="BUTTON" VALUE="Go"><BR>
<TEXTAREA ID="txtProgress" COLS="60" ROWS="10"> </TEXTAREA><BR>
<TEXTAREA ID="txtOutput" COLS="60" ROWS="10" STYLE="visibility: hidden"> </TEXTAREA>
</BODY>
</HTML>
... Will run just fine if this page is stored on the user's hard drive. They will
still get an ActiveX warning they must OK though, unless somebody has set their IE security to "no prompt" for local unsafe ActiveX controls.
But the reason it works is that
sort.exe is assumed to already be installed on their computer!
You can even make it work from a web server, if the IE security settings for the web server or its network are set low enough. Once again, it only works because
sort.exe is already installed.
And even
then this page can't be modified to write the "raw" or the "srt" files on the web server's hard drives.
Now "can't" and "impossible" are bad words to use. With enough ingenuity you can make almost anything happen somehow. But browser security works
very hard to keep such things from happening to prevent users' systems from being corrupted/infected, and server security fights to keep the server safe as well.
The only way I can think of to do this sort of thing is for the user to upload input to a posting acceptor of some sort at the server, the server to run your program, and then to present the result file for the user as a download they can do. And this assumes you want the user to do this in the first place: it sounds like the input and/or output is supposed to stay at the server or something. Perhaps the output is to be displayed back formatted as an HTML page or something?
In any case, you need to run your program server-side. Even if you DID get it to run client-side for some reason by some method (installing it on every user's machine?) you aren't going to be able to have the client read/write the server's hard drive.
If I've missed the point, try explaining further. Maybe somebody can still help you with this.