Standard or higher

VBScript, JavaScript, Lotus Domino, LotusScript
Barcodes in scripting languages

How to use barcodes in VBScript (Windows Script Host)


You can use ActiveBarcode with VisualBasic-Script (VBS, Windows Script Host) to create barcodes in scripts automatically. This example shows how simple is it to use ActiveBarcode in VBS.

First make the ActiveBarcode control available in your script:
  Dim barcode
  Set barcode = WScript.CreateObject("ACTIVEBARCODE.BarcodeCtrl.1")
Now you can use the variable barcode to access the control.
Use the Properties of the control to create the barcode you want:
  barcode.Typename = "Code128"
  barcode.Text = "123456789012"
Then use the SaveAsBySize method to save the barcode in a specific size to an image file:
  barcode.SaveAsBySize "beispielbarcode.png",400,200
Click here to download the above example as a wsf-file.

A very detailed example for a VisualBasicScript application is the console application BarcodeImage:You can use this source code to learn how to use the ActiveBarcode Control in a VBS script or you can use it as a basis for your own script.

How to use the barcode object with JavaScript

Use the ActiveBarcode control with JavaScript to create a barcode:
  // Create the control:
  ab = new ActiveXObject("ACTIVEBARCODE.BarcodeCtrl.1");
  // Set the barcode type and content:
  ab.text = "Example";
  ab.typename = "Code 128";
  // Save the barcode as image file:
  ab.SaveAsBySize("example.bmp", 400, 100);
Hint: A more universal approach with JavaScript is to use the ActiveBarcode REST API.

Using the barcode control in a LotusScript agent

This is a script example to run under IBM's Lotus Domino as a LotusScript agent:
Option Public
Option Declare
Sub Initialize()
  Dim MyObject As variant
  Set MyObject = CreateObject("ACTIVEBARCODE.BarcodeCtrl.1")
  MyObject.text = "Example"
  MyObject.typename = "Code 128"
  MyObject.SaveAsBySize "c:\example.bmp", 400, 100
End Sub