Monthly Archives: February 2008

How to run an exe in coldfusion

Cold fusion is a CGI language like asp, php. Sometimes, you may need to call an external exe in coldfusion.

It is absolutely doable in coldfusion. For exmaple, if you want to call cscript.exe, here is what you can do:

<cfexecute name = “C:WindowsSystem32cscript.exe
  arguments = “pdfmerge.vbs  c:1.pdf|c:2.pdf  c:out.pdf”
  outputFile = “C:Tempoutput.txt”
  timeout = “100″>

A handy script to convert html to image

You may need to run a command line utility to convert html or url to image. Here is a handy script that converts url/html to image with our award winning htmlsnapshot product.

Save the below code into a script snapurl.vbs (Or you can find this script in htmlsnapshotdemovbscript)

set args = WScript.Arguments
num = args.Count

if num <> 2 then
   WScript.Echo “Usage: [CScript | WScript] snapurl.Vbs Url ImageFile”
   WScript.Quit 1
end if

‘demo how to convert html to image
Dim snap

‘Create the Html Snapshot Object
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
snap.SetCode “Input your license code here to remove watermark”
snap.SnapUrl args.Item(0), args.Item(1)
WScript.echo “Snap return:” & CStr(snap.GetErrorCode)

‘Free object
Set snap = Nothing

 After that, you can run on command line like below:

cscript.exe snapUrl.vbs g.jpg
cscript.exe snapUrl.vbs file://c:1.html g.jpg