Home. 
.

transparent

transparent

transparent

Authentic Scripting

Altova StyleVision® 2012 includes a complete integrated scripting environment that allows you to build advanced content entry and eForms applications based on the Authentic platform.

Authentic scripting lets developers create robust data entry applications for Authentic users who can directly update XML and database sources using eForms designed entirely in StyleVision. Scripts are created in StyleVision and executed in Authentic, giving Authentic users the ability to work with interactive eForms directly within Authentic Desktop or Browser. The scripting functionality (event handlers, macros, and forms) is embedded directly into the StyleVision design (SPS) so that Authentic end-users only need to open the file to work with complex, detailed, and user friendly eForms.

Event handler and macro components can be written using supported scripting languages, JavaScript or VBScript, and you can also design input forms graphically using drag and drop functionality.

To embed scripting functionality in a StyleVision design (SPS), you can open the Scripting Editor window via the Authentic | Edit Authentic Scripts menu command or by choosing Authentic Script from the Design tab context menu.

call scripting editor

The Scripting Editor provides an interface through which you can create any of the following four main components:

  • Global declarations - scripts that contain variables and functions that can be used by forms, event handlers, and macros.
  • Macros - scripts that are used to assign user-defined actions to design elements, toolbar buttons or context menu items.
  • Event handlers - scripts that can be associated with a variety of available events (OnSave, OnValidate, etc.) for user interface elements in an Authentic form. The return value from the script typically instructs the application how to continue its processing.
  • Forms - simple graphical components made up of text input fields, buttons, and so on. Forms are used to show dialogs or request additional user input within scripts that are used as event handlers and macros.

Global Declarations

The GlobalDeclarations component is presented by default in every scripting project. Variables and functions are added using code fragments written in the scripting language (JScript or VBScript) associated with your project.

An example function, StartChangingAddress, appears below:

function StartChangingAddress( sTo )
{
	elemAddress =
		AuthenticView.XMLDataRoot.
		GetChildElement( "ScriptingSamples", 0 ).
		GetChildElement( "Address", 0 );
	
	// first, delete all existing children of the Address element
	elemAddress.EraseAllChildren();
	
	// append the new attribute value
	attrUSorEU = AuthenticView.CreateXMLNode( spyXMLDataAttr );
	attrUSorEU.Name = 'USorEU';
	attrUSorEU.TextValue = sTo;
	elemAddress.AppendChild( attrUSorEU );
	
	// append the EU or US element which will contain address details
	elemParent = AuthenticView.CreateXMLNode( spyXMLDataElement );
	elemParent.Name = sTo;
	elemAddress.AppendChild( elemParent );
	
	return elemParent;
}

Variables or functions created in the global declarations script are accessible to all forms, event handlers, and macros in your scripting project.

Macros

Macros let you create functions that are called from other scripts or event handlers. For example, the macro shown below uses the GlobalDeclarations, including the StartChangingAddress function, to create a form for adding information to an active XML document.

elemParent = StartChangingAddress( 'EU' );

// and now append all address elements in EU
elemChild = AuthenticView.CreateXMLNode( spyXMLDataElement );
elemChild.Name = 'Street';
elemParent.AppendChild( elemChild );

elemChild = AuthenticView.CreateXMLNode( spyXMLDataElement );
elemChild.Name = 'City';
elemParent.AppendChild( elemChild );

elemChild = AuthenticView.CreateXMLNode( spyXMLDataElement );
elemChild.Name = 'Country';
elemParent.AppendChild( elemChild );

Macros can be specified and associated with StyleVision design elements using the Authentic group in the Properties window. Object events that are supported for macros are:

  • OnBeforeChange
  • OnAfterChange
  • OnBeforeLinkClick
  • OnClick
  • OnSetFocus
  • OnKillFocus

macro button

Macros are controlled in the right-click menu of the scripting project tree, where you can add or rename.

macro menu

Event Handlers

Event handlers can also be defined by selecting the Events icon in the toolbar of the Properties and Events pane. Here, you can define the behavior that the application should exhibit once a specific action is initiated or completed. Events that can be controlled include mouse movement and clicks, drag and drop, key presses, and more.

Authentic View event scripts in StyleVision® 2012 include:

  • On_AuthenticLoad – allows Authentic to set up features before the user starts working with the file
  • On_AuthenticBeforeSave – lets you prevent saving if, for example, entered data is not complete
  • On_AuthenticToolbarButtonClicked – allows behavior to be extended/modified on toolbar click
  • On_AuthenticUserAddedXMLNode – lets Authentic load any child nodes or textual content to the newly added XML node, if necessary, so that the form is prefilled with data

The scripting editor provides a folder which contains the full set of events for which event handler scripts can be written.

event handlers

Forms

The Authentic Scripting Editor lets you graphically build forms using a palette of objects such as text input fields, buttons, labels, and more.

General form properties such as size, background color, font styles, etc. are defined in the Properties pane.

form menu

The form object palette provides all of the objects that are available. Registered ActiveX controls can also be added by selecting the Add ActiveX Control command in the right-click menu.

form palette

Once an object has been inserted in your design, you can specify its appearance properties - such as alignment, borders, scroll bars, etc. - in the Properties pane.

Scripting in Practice

Authentic View scripting gives StyleVision designers complete and flexible control over various aspects of the user interface. In addition, a revamped Java API and extensions to the existing COM APIs add more flexibility for scripting and interactive eForm design. For example:

  • Interactive object-specific design elements - such as the click of a button, modification of form elements, focus change between fields, etc. - can be accessed through the Authentic interface. User actions include OnClick, OnBeforeLinkClick, OnBeforeChange, OnAfterChange, OnSetFocus, and OnKillFocus.

    create onclick button

  • Entry helper windows can be suppressed to ensure that Authentic end-user access is limited only to modification of the intended elements, attributes, and entities.
  • Context (right-click) menus can be completely customized by removing existing or adding new commands.

  • New toolbar buttons can be created and associated with macros, giving the designer the ability to add completely new commands to the toolbar.

    create toolbar buttons

  • Custom and standard toolbars can be modified by disabling any buttons that the end-user should not have access to.

    custom toolbar buttons

  • The COM API has been extended with new interfaces and additional methods and properties including: AuthenticView (i.e. CreateXMLNode, EvaluateXPath, GetToolbarButtonState), AuthenticRange (i.e. IsSelected, GetVariableValue), XMLData (i.e. GetChildElement, InsertChildAfter), AuthenticEventContext (i.e. GetXMLNode, SetVariableValue), and AuthenticContextMenu (i.e. CountItems, DeleteItem, GetItemText).

    Note For more information on the Authentic Java API or COM API, see the User & Reference Manual included with the product.

  • .NET 2.0 – 4.0 Support
  • Additional .NET assemblies are easily accessible from the Global Assemblies Cache (GAC), MSVS .NET References, or assembly files stored on your network or machine

    .NET assemblies

Altova provides various examples of StyleVision scripts in practice in the examples that ship with the product.


Test drive the powerful Authentic View Scripting Editor to add an interactive element to your data entry applications. Download a free 30-day trial of StyleVision.

Download a free 30-day trial of Authentic® 2012 Enterprise Edition.



transparent
Download
Pricelist
Buy
Video
Online Training
Comparison
Datasheet
Print
Mail
Like It
.

Altova Authentic

.

Read about how Altova product managers created an RSS editing solution based on Authentic forms.

.
Schema Library
.

See Altova's schema library, a collection of links and resources for common (and uncommon) industry and cross-industry schemas.

.
.

transparent

transparent