Ok, I've not been successful in finding an answer to this problem, so I'm hoping someone here can help. I'm still having trouble running a perl script on the server from an ASP intranet page. Here is the code snippet that I'm currently testing:
Basically what I'm trying to do is run the following script:Code:System.Diagnostics.Process fpsProc = new System.Diagnostics.Process(); // Declare New Process string currentConvScript = ""; StreamWriter fpsInput = null; StreamReader fpsOutput = null, fpsError = null; try { fpsProc.StartInfo.WorkingDirectory = fpsConvDir.Value; fpsProc.StartInfo.UseShellExecute = false; fpsProc.StartInfo.RedirectStandardInput = true; fpsProc.StartInfo.RedirectStandardOutput = true; fpsProc.StartInfo.RedirectStandardError = true; fpsProc.StartInfo.FileName = "cmd"; // Program or Command to Execute. fpsProc.StartInfo.CreateNoWindow = true; fpsProc.Start(); fpsInput = fpsProc.StandardInput; fpsInput.AutoFlush = true; if (radio30to24.Checked){ fpsInput.WriteLine("perl "+script30to24+" "+fpsInputString); currentConvScript = script30to24; } if (radio25to24.Checked){ fpsInput.WriteLine("perl "+script25to24+" "+fpsInputString); currentConvScript = script25to24; } if (radio60to30.Checked){ fpsInput.WriteLine("perl "+script60to30+" "+fpsInputString); currentConvScript = script60to30; } fpsInput.Close(); fpsProc.WaitForExit(5000); // Waits for the process to end. fpsOutput = fpsProc.StandardOutput; fpsError = fpsProc.StandardError; if(!fpsProc.HasExited) // Just To Be Safe. { fpsProc.Kill(); fpsProc.Close(); if (fpsOutput != null) fpsOutput.Close(); if (fpsError != null) fpsError.Close(); setFPSConvStatus(1, "Conversion Error", "ErrorMsg."); return; } // write fpsOutput to Response Response.Write("fpsOutput: \""+fpsOutput.ReadToEnd()+"\"<br>"+"fpsError: \""+fpsError.ReadToEnd()+"\""); } catch(Exception e) { fpsProc.Close(); if (fpsInput != null) fpsInput.Close(); if (fpsOutput != null) fpsOutput.Close(); if (fpsError != null) fpsError.Close(); setFPSConvStatus(1, "Conversion Error", e.ToString()); return; } // Send status message for successful conversion fpsProc.Close(); if (fpsOutput != null) fpsOutput.Close(); if (fpsError != null) fpsError.Close();
When I do this in the command window on the server, I get output which is pretty similar to the input file, since it doesn't actually convert anything but timecode sequences and this is just a random text file. However, when I attempt to execute this using the code above, I get the following error:Code:perl X:\ENG\scripts\30to24_v0.5 Z:\TMP\ENG\fpsConvert\scratchpad.rtf
What I can't figure out, for the life of me, is why there's different behavior for the exact same script execution lines. I ran the exact same line in the Run window and it worked fine. Not sure what else to try to get this to run, but it needs to run! Please help!!Code:Cannot open input file 'Z:\TMP\ENG\fpsConvert\scratchpad.rtf'


Reply With Quote