Create results for a simple field Script Locator
You can write a script routine to perform any operation within the limitations of the Tungsten TotalAgility object structure. For full documentation about scripting, see the Tungsten TotalAgility Scripting Help.
Typically, the script routine is written to produce the results of the Script Locator, usually by retrieving and modifying the data from other locators. These results can then be associated with extraction fields by assigning the Script Locator to a field.
You can create results for a simple field script locator by following these steps:
-
Define where the
pLocator comes from using the following example:
Dim pLocator As ICscXDocField Set pLocator = pXDoc.Locators.ItemByName(<Name of Script Locator>) -
Create one or more alternatives as follows:
pLocator.Alternatives.Create -
In combination with additional logic, use the results from other locators to create the required values within the
Script Locator. Retrieve results from other locators as follows:
pXDoc.Locators.ItemByName(<Locator Name>).Alternatives(<N>).TextThis example retrieves the alternative with index N from a locator producing multiple single-result alternatives, such as a Format Locator.
pXDoc.Locators.ItemByName(<Locator Name>).Alternatives(<N>).Subfields.ItemByName(<Subfield Name>).TextThis example retrieves a subfield result from a locator producing multiple subfields per alternative, such as an Advanced Zone Locator.
-
Assign text values to the alternatives in the
Script Locator alternatives collection.
pLocator.Alternatives(<N>).Text = <Text Value> -
Assign a confidence value (between 0 and 1) to the alternatives in the
Script Locator alternatives collection.
pLocator.Alternatives(<N>).Confidence = <Confidence Value> -
If required, assign coordinate values (in pixels) to the alternatives in the
Script Locator alternatives collection.
pLocator.Alternatives(<N>).Top = <Top Coordinate>pLocator.Alternatives(<N>).Left = <Left Coordinate>pLocator.Alternatives(<N>).Height = <Height>pLocator.Alternatives(<N>).Width = <Width>
Related topics: