The following sample shows you how to apply TFORMer Runtime in VB Script (Microsoft Visual Basic Scripting). This example is available with the installation of TFORMer:
Create the required instances for TFORMer Runtime (tformer) and for a print job (printJob).
Set tformer = CreateObject("TFormer5Lib.TFormer")
Set printJob = tformer.CreateJob ' Create an output job
Adjust the form layout using repository (..\..\Demo Repository\Demos.tfr), project (TFORMer_Runtime_Examples) and form name (BarcodeLables) according to your needs:
printJob.RepositoryName = "..\..\Demo Repository\Demos.tfr"
printJob.ProjectName = "TFORMer_Runtime_Examples"
printJob.FormName = "BarcodeLabels"
The data fields in the form are filled with the values taken from the data source. (NewDataSourceRecordSet). This is done directly from the program code (AddNewRecord und SetDataField). You can also import data field values by means of external database or files:
Set dataSource = printJob.NewDataSourceRecordSet
dataSource.ClearRecords
dataSource.AddNewRecord
dataSource.SetDataField "ArticleName", "Mac Adaptor"
dataSource.SetDataField "ArticleNo", "12001234"
dataSource.SetDataField "ArticlePrice", "39,00"
Form printing and exporting. Choose from an output device or an export format (here the pdf file output.pdf):
printJob.PrinterName = "PDF:" & objEnv("TMP") & "\output.pdf"
printJob.PrintForm