11.4. Windows Scripting

11.4.1. Prerequisite

Before you experiment the samples in this article, you need to have the VBScript run time installed on your computer. The VBScript run time engine comes with Microsoft Internet Explorer 4.0 or above.

The scripting environment also requires you to have the design-time license of the Barcode control. This can be assured by running the installer provided by Morovia.

11.4.2. Details

A great feature of Morovia Barcode ActiveX is Windows Scripting integration. The interface is carefully designed and implemented to be compatible with scripting languages, such as VBScript and Jscript. This allows you to batch generate barcode images with several lines of code:

Dim oStr
Set OStr = WScript.CreateObject("Morovia.BarcodeActiveX")
Ostr.AutoSize = true
ostr.RasterImageResolution=96
ostr.BorderWidth=0
ostr.ShowComment=0
ostr.SymbolMarginTop=0
ostr.SymbolMarginBottom=0
ostr.SymbolMarginLeft=0
ostr.SymbolMarginRight=0
ostr.BarHeight=1000
ostr.Font.Name = "Arial"
ostr.Symbology = 10
ostr.Message = "978020161594|53995"
oStr.ExportImage "ean-13-sample.jpg", 1
ostr.Symbology = 12
ostr.Message = "0-87779-709-9|90000"
ostr.ExportImage "bookland-Sample.jpg", 1

The code above generates two barcode image files, one for an EAN-13 and another for Bookland.

If you are using Barcode ActiveX lite version, you need to change the ProgID from Morovia.BarcodeActiveX to Morovia.BarcodeLite.