Scripting/Automation

Accessing the automation interface

Automating Studio Products

Your application provides a new, industry standard interface that allows you to write scripts using JavaScript or VBScript (or any other COM-aware scripting language)

These scripts are commonly embedded into an HTML document, which can then be loaded into your application interface to execute commands using the Customization window. You can also automate your Studio application from outside your application, say, from a compiled Visual Basic execuatble.

As well as running individual commands from scripts you can also run your existing macros and Command Line programs which have for a long time been a feature of Datamine systems.

Scripting and HTML

HTML can be used to create user interfaces for scripts.

 

You could, for example, create a simple interface to specify input and output file names, and maybe field and parameter values, or add extra buttons, radio buttons, text boxes, check boxes, and so on, in order to make your interface more flexible.

 

The following figure shows a simple customization script loadedt into the Customization control bar.

 

 

Changing an interface means editing the underlying HTML script.  However as well as adding a text box or push button you also need to define the action or event that occurs when you enter data into the text box or click the button.  You can run both Database and Datamine commands from these scripts as well as carrying out the usual programming functions.  You can also interface with other systems through scripting.

Scripting and File Precision

Your application supports both single- and extended-precision files. Full details of how this is implemented can be found in Project Files, although in basic summary; extended-precision projects will support the inclusion of both single- and extended-precision files, however, all files generated by the running of processes will be extended-precision. In contrast, a single-precision project will only support single-precision files; any attempts to load an extended-precision file through the application interface will result in a notification of such, and prevention of further processing.

This has implications for automation. Unless explicitly scripted, validation of incoming data (for example, the input file of the HOLES3D process cannot be an extended-precision file if the current project is single-precision) does not automatically get triggered when incompatible file extensions are specified as parameters for a given process through scripting (or macro writing). As such, it is important that all files that are defined using the application automation interface are commensurate with the project file in situ at the time, or errors may occur.

Automation isn't just restricted to Datamine functionality; you can also apply scripted solutions to the following areas of functionality:

  • Data Source Drivers: you can automate the import/export of single/multiple files (ideal for batch processing) using the new DSDIE component. For more information on accessing and manipulating this data transfer control mechanism, please refer to your Data Converter utility's online Help.

  • Table Editor: Datamine Table Editor is a standalone application that can be used to view and edit the contents of Datamine (.dm) files. This functionality is also scriptable, and allows you to perform automation tasks across one or more tables, ensuring consistent results with the minimum of effort. The Table Editor component can also be embedded in a web environment for a more flexible approach to deploying your company data. For more information on Table Editor scripting, please refer to your Table Editor's online Help.

For more ideas regarding automation, refer to your Scripting Tutorial (it's in the Help menu).

Problems running scripts?

Studio Customization windows are an embedded Internet Explorer component and inherit all settings from the core IE application, including security settings.

The following settings must be enabled in IE to allow Datamine's Customization window to run automation scripts:

  • Initialise and script ActiveX controls not marked as safe for scripting
  • Run ActiveX controls and plug-ins
  • Script ActiveX controls marked safe for scripting

 

Where permissions are insufficient, you may see the message "Automation server cannot create object" when running scripts. Permissions are commonly the cause of this error, but not the only potential cause.

It is also possible for your operating system to remove important system registry values during an update, or for antivirus and other system software to actively block the running of scripts.

For more information on resolving these articles, please refer to the following Knowledge Base article (TN00303):

https://datamine.freshdesk.com/en/support/solutions/articles/19000093069-troubleshooting-automation-server-can-t-create-object