Script resources

You can define and modify script resources so that you can reference them in your script. Script resources commonly are used for text strings, such as error messages, field values or log file entries. Each script resource is defined by a key and for each key there is a corresponding string that can contain any kind of text.

You can configure the script resources and change their values within Project Builder Script Resources using the Script Resources window. Additionally, you can provide translations for the script resources.

The following script snippet shows an example with hard coded text:

Private Sub Document_BeforeExtract(ByVal pXDoc As CASCADELib.CscXDocument)
   pXDoc.Fields.ItemByIndex(0).Text = "This is some text"
End Sub

When using the script resources object, you can retrieve the resource with a key. For this example, you have to define in the Script Resources window a key "Text1" and its corresponding string "This is some text". The following script snippet retrieves the resource with the key "Text1":

Private Sub Document_BeforeExtract(ByVal pXDoc As CASCADELib.CscXDocument)
   pXDoc.Fields.ItemByIndex(0).Text = Project.Resources.GetString("Text1")
End Sub