How to launch the program from ASP?
You need to install Windows Script 5.6 on your server to launch Image Converter 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 lauching Image Converter Command Line from ASP using JavaScript
and VisualBasic syntax.
Example with JavaScript syntax:
<%@ LANGUAGE = "JAVASCRIPT" %>
<% // The path to Image Converter Command Line with its parameters
var commandLine = "C:\\Program Files\\ImageConverter Plus\\ICPCL.exe -convertto tiff -source "C:\\Inetpub\\wwwroot\\Source\\*.*\" -dest "C:\\Inetpub\\wwwroot\\out" -template exists:overwrite "; // Creating a WSH object
var WshShell = Server.CreateObject("WScript.Shell"); // Launching Image Converter Command Line
var oExec = WshShell.Exec(commandLine); var Buf = ""; // The program response stream
while (!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 == "\n") { Buf = "<BR>" + Buf; }
// Writing out the program response
Response.Write(Buf); } WshShell = null; %>
<% // The path to Image Converter Command Line with its parameters
var commandLine = "C:\\Program Files\\ImageConverter Plus\\ICPCL.exe -convertto tiff -source "C:\\Inetpub\\wwwroot\\Source\\*.*\" -dest "C:\\Inetpub\\wwwroot\\out" -template exists:overwrite "; // Creating a WSH object
var WshShell = Server.CreateObject("WScript.Shell"); // Launching Image Converter Command Line
var oExec = WshShell.Exec(commandLine); var Buf = ""; // The program response stream
while (!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 == "\n") { Buf = "<BR>" + Buf; }
// Writing out the program response
Response.Write(Buf); } WshShell = null; %>
Example with VisualBasic syntax*:
<%
' Defining variables
Dim WshShell, oExec, CommandLine, Buf
' The path to Image Converter Command Line with its parameters
' Don`t forget -nodlg key in demo version
CommandLine = "C:\\Program Files\\ImageConverter Plus\\ICPCL.exe -convertto tiff -source "C:\\Inetpub\\wwwroot\\Source\\*.*\" -dest " C:\\Inetpub\\wwwroot\\out" -template exists:overwrite "
' Creating a WSH object
Set WshShell = Server.CreateObject("WScript.Shell")
' Launching Image Converter 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
%>
' Defining variables
Dim WshShell, oExec, CommandLine, Buf
' The path to Image Converter Command Line with its parameters
' Don`t forget -nodlg key in demo version
CommandLine = "C:\\Program Files\\ImageConverter Plus\\ICPCL.exe -convertto tiff -source "C:\\Inetpub\\wwwroot\\Source\\*.*\" -dest " C:\\Inetpub\\wwwroot\\out" -template exists:overwrite "
' Creating a WSH object
Set WshShell = Server.CreateObject("WScript.Shell")
' Launching Image Converter 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