Launch the program from ASP

You need to install Windows Script 5.6 on your server to launch Resize Pictures for Command Line from ASP script. You can read more about Microsoft Windows Script and download it from: http://msdn.microsoft.com/scripting/default.asp.

If you don't know, what version of the Windows Script is already installed on your server click here. Below you will find examples of launching Resize Pictures for Command Line from ASP using JavaScript and Visual Basic syntax.

Example with JavaScript syntax:

<%@ LANGUAGE = "JAVASCRIPT" %>
<%

// The path to Resize Pictures for Command Line with its parameters
var commandLine = "C:\\rpcmd\\rpcmd.exe -s demo.set -i e:\\pics\\*.* -o e:\\out";

// Creating a WSH object
var WshShell = Server.CreateObject("WScript.Shell");

// Launching Resize Pictures for Command Line
var oExec = WshShell.Exec(commandLine);

var Buf = "";

// The program response stream
while (!oExec.StdOut.AtEndOfStream)
{
        Buf = oExec.StdOut.Read(1);
        if (Buf == "\n")
        {
              Buf = "<BR>" + Buf;
        }

        // Writing out the program response
       Response.Write(Buf);
}

WshShell = null;
%>


 

Example with Visual Basic syntax:

<%
' Defining variables
Dim WshShell, oExec, CommandLine, Buf

' The path to Resize Pictures for Command Line with its parameters
CommandLine = "C:\\rpcmd\\rpcmd.exe -s demo.set -i e:\\pics\\*.* -o e:\\out"

' Creating a WSH object
Set WshShell = Server.CreateObject("WScript.Shell")

' Launching Resize Pictures for Command Line
Set oExec = WshShell.Exec(CommandLine)

' The program response stream
Do While Not oExec.StdOut.AtEndOfStream
Buf = oExec.StdOut.Read(1)

' If the current symbol is a line feed -> the "<BR>" tag should be added for HTML line feed
if Buf = Chr(13) then Buf = "<BR>" & Buf

' Writing out the program response
Response.Write Buf
Loop
Set WshShell = Nothing
%>

 

 
If you don't know, what version of the Windows Script is already installed on your server:
Try to run one of example above, using your correct command line.

If an error page ("HTTP 500.100 - Internal Server Error - ASP error") will appears and a text "Object doesn't support this property or method" will be in the "Error type" item then Windows Script on your server has a version older than 5.6 and you need to install Windows Script 5.6 from http://msdn.microsoft.com/scripting/default.asp.

Back Back