October 11, 2021
Not able to run vbscript using cfexecute on Windows Server 2019 Data Center 64 bit Machine
Comments
(1)
October 11, 2021
Not able to run vbscript using cfexecute on Windows Server 2019 Data Center 64 bit Machine
(1)

Hi,

Goal: To run VBScript using CFexecute using command base script Cscript.exe

Environment:  ColdFusion 2021, Windows Server 2019 , 64 bit Machine.

My VB Script(ExcelToPDF.vbs) performs simple office automation .

So first I tried with command line to run ExcelToPDF.VBS.

C:WindowsSystem32 > cscript.exe //nologo D:ExcelToPDF.vbs D:test.xls D:test.pdf

and got expected o/p Success (generates the Excel to PDF file )

Now, I have to see whether CF runs correctly or not.
So I use cfexecute to run ExcelToPDF.VBS.

code:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>

<html>
<head>
<title>Untitled</title>
</head>

<body>
<cfoutput>

<h1>Test easyPDF SDK</h1>

<cfset inFile = “C:easypdfexcell.xlsx” />
<cfset outFile = “C:easypdftrst.pdf” />

</cfoutput>

<cfexecute
name=’cscript.exe’
arguments=’C:easypdfExcelToPDF.vbs //Nologo #inFile# #outFile#’
timeout=”500000″/>
</body>
</html>

vb script code:

Dim excelFile, pdfFile

Set oPrinter = CreateObject(“easyPDF.Printer.8”)
Set oPrintJob = oPrinter.ExcelPrintJobEx

oPrintJob.NativeOfficePDF = True
oPrintJob.PrintAllSheets = True
Set objArgs = Wscript.Arguments

excelFile = objArgs(0)
pdfFile = objArgs(1)
oPrintJob.PrintOut excelFile, pdfFile

Set oPrintJob = Nothing
Set oPrinter = Nothing

1 Comment
2024-04-18 03:16:11
2024-04-18 03:16:11

I’ve got some gossip about Microsoft Office automation.

VBScript is so old-fashioned and sometimes obscure and not readable.

The WPS Office, manufactured by we Chinese, uses JavaScript for the Office automation instead.

BTW, I tend to use Authorware-style presentations more than Powerpoint… I wish that it’ll have a new release or update. But it has been abandoned.

But now Adobe has a software named Captivate…It’s good too. A lil’ bit expensive.

Like
Add Comment