DEVELOPER GUIDE PIPELINE PILOT INTEGRATION COLLECTION 2016 Copyright Notice
Total Page:16
File Type:pdf, Size:1020Kb
DEVELOPER GUIDE PIPELINE PILOT INTEGRATION COLLECTION 2016 Copyright Notice ©2015 Dassault Systèmes. All rights reserved. 3DEXPERIENCE, the Compass icon and the 3DS logo, CATIA, SOLIDWORKS, ENOVIA, DELMIA, SIMULIA, GEOVIA, EXALEAD, 3D VIA, BIOVIA and NETVIBES are commercial trademarks or registered trademarks of Dassault Systèmes or its subsidiaries in the U.S. and/or other countries. All other trademarks are owned by their respective owners. Use of any Dassault Systèmes or its subsidiaries trademarks is subject to their express written approval. Acknowledgments and References To print photographs or files of computational results (figures and/or data) obtained using BIOVIA software, acknowledge the source in an appropriate format. For example: "Computational results obtained using software programs from Dassault Systèmes BIOVIA. The ab initio calculations were performed with the DMol3 program, and graphical displays generated with Pipeline Pilot." BIOVIA may grant permission to republish or reprint its copyrighted materials. Requests should be submitted to BIOVIA Support, either through electronic mail to [email protected], or in writing to: BIOVIA Support 5005 Wateridge Vista Drive, San Diego, CA 92121 USA Contents Chapter 1: Introduction 1 Property List Interface 19 Windows Script Host (WSH) 1 Interface Methods for Data, Globals and General Requirements 1 Parameters Objects 19 Additional Information 2 Chapter 8: Handling Errors 23 Chapter 2: Scripting Components 3 Reporting Errors in VBScript 23 VBScript Components 3 Reporting Errors in Python 23 VBScript Requirements 3 Chapter 9: Debugging Scripts 25 VBScript Component Parameters 3 Line Number Information 25 VBScript Examples 4 MsgBox() in VBScript 26 Viewer Examples 4 Server-Side Debugging 26 Calculator Examples 4 Writing the Debug Output to a File 26 Filter Examples 4 Writing the Debug Output to a Property 26 Generator Examples 4 Chapter 10: Script Writing for Web Service Protocols 27 Dialog Examples 4 Python Component 6 Python Scripting Requirements 6 Python Component Parameters 6 Python Examples 6 Chapter 3: Scripting Guidelines 7 Selecting a Scripting Language 7 Granularity of Scripting Components 7 Planning for Change 7 Chapter 4: Editing Scripting Components 9 Editor Toolbar Buttons 9 Viewing Available Methods 9 Viewing Method Signatures 10 Viewing Calculable Properties 10 Finding Text 11 Chapter 5: Scripting Component Settings 13 Scripting Parameters 13 Initial Script 13 Script 14 Final Script 14 Created Data Class Name Parameter 14 Setting Icon and Ports 14 Chapter 6: Modes of Use 16 Chapter 7: Scripting Objects and API 17 Scripting Objects 17 Data 17 Globals 17 Parameters 17 Component 17 Component Properties 17 Component Methods 18 Chapter 1: Introduction You can enhance the capabilities of Pipeline Pilot by using scripts in your protocols. Scripting allows you to build customized components that access and modify the content of each data record and global protocol data. Components are available in the Integration collection for designing your own custom components. This guide shows you how to use the scripting components that are based on Windows Script host (WSH). You can use both VBScript and Python script syntaxes with the components covered in this guide. Note: Cross-platform component development is also supported in the Integration collection for Perl and Java. Details are covered in other user guides in this document set. Scripting components provide a way to program component behavior, with access to: Client- and server-side software packages that support COM automation Pre-existing script or GUI utilities that you can integrate with Pipeline Pilot Client As a component designer, you have access to the contents of each data record passed to the script component and to the relevant parameter and global settings. This allows you to write components such as data readers, data writers, data filters, and calculators. You can employ the full range of intrinsic functions built into the specific scripting language, and incorporate functionality from the range of public modules available for the specific scripting language. Windows Script Host (WSH) The VBScript and Python scripting components are dependent on scripting engines written for the Windows Script Host (WSH). WSH is a tool that is included in later releases of the Windows operating system, Internet Explorer, and Windows 2000 Server (for use with login and standalone scripts). WSH creates an environment for hosting scripts. When a script is run, WSH plays the part of the host—it makes objects and services available for the script and provides an environment within which the script is executed. WSH supports scripting to the Windows platform, allowing you to run scripts from both the Windows desktop and the command prompt. Its scripting capabilities are more powerful than batch files; scripts running in the WSH environment can leverage the power of WSH objects and other COM-based technologies. General Requirements To use scripting components, you need the separately licensed Integration collection. The scripting components require the following third-party software: Third-party scripting engines that support components for Perl, VB, and Python implemented using Windows Script Host (WSH). These applications may need to be installed on both the server and client. The Integration collection includes the required scripting engines for Perl. To work with the scripting components and manipulate the program data, you need experience writing scripts in the language supported by the component, and you need to know about the objects made available to the scripting engines and the scripting interface that each exposes. For example, there are some simple component properties that define the behavior of the scripting component (which determine if it is a data reader, a filtering component, etc.) Introduction | Page 1 For Python scripting support, you need to install the WSH engine for Python, freely available as a part of the Python for Windows installation from Active State at http://www.activestate.com/activepython. Additional Information For more information about the Pipeline Pilot Integration collection and other BIOVIA software products, visit https://community.3dsbiovia.com. Page 2 | Pipeline Pilot • Developer Guide Chapter 2: Scripting Components The Integration collection includes the following Windows scripting components: VBScript (on Client) VBScript (on Server) Python (on Server) Notes: From the Components tab, the VBScript components are available in "Database and Application Integration\Application Integration\Programmatic Integration". Python (on Server) is a prototype (due to a memory leak issue with the Python WSH module). It is located in "Database and Application Integration\Prototypes\Application Integrators". VBScript Components VBScript is a scripting language for Microsoft platforms. It is included with Internet Explorer on Windows platforms and is well-suited for automating external applications, because it includes syntax to interact with COM components. VBScript cannot run on its own; it must be hosted by another application (such as Internet Explorer or a VBScript component). The Integration collection's VBScript components are ideally suited for writing client- and server-side scripts that automate visualization tools such as Microsoft Office programs, data graphing tools, and your own custom dialogs. The following VBScript components are available in the Integration collection: VBScript (on Client): Targeted at GUI components that need to interact with users on their own systems (for example, to display dialogs or results in Excel). VBScript (on Server): Intended for non-graphical, non-blocking operations, such as accessing a COM automation application that does not require user interaction. VBScript Requirements To employ a VBScript component, you need to have some experience using VBScript to write scripts. For more information on the basics of writing VBscripts, see Microsoft's VBScript documentation at http://msdn.microsoft.com/en-us/library/t0aew7h6.aspx. Note: Visual Basic (VB) is not the same as VBScript, although they share much common syntax. VB is a programming language for developing standalone applications and libraries and is outside the scope of scripting in Pipeline Pilot Client. VBScript Component Parameters To define the behavior of a scripting component, you write lines of script for one or more of the three parameters: Initial Script, Script, and Final Script, explained in Scripting Parameters. (Detailed information about how to set the parameter values is also available when you have a VBScript component open in Pipeline Pilot Client's script editor, which is designed to supply you with information as you need it.) Scripting Components | Page 3 You can also add you own custom parameters to allow protocol authors to modify the behavior of your VBScript component. VBScript Examples Pipeline Pilot includes example protocols that illustrate how to use the VBScript components. These protocols include help and highlight points of interest. We recommend that you read the comments and help for each protocol before using them. You may find it productive to use the examples as a template for your own scripting components. Note: From the Protocol tab, the VBScript examples are available in "Examples\Integration\Integrating Applications\Scripting Examples". Viewer Examples Simple Excel Automation: Use VBScript as a COM automation client. It contains a subprotocol for