intouch hmi scripting and logic guide intouch hmi scripting and

Download InTouch HMI Scripting and Logic Guide  InTouch  HMI Scripting and

Post on 14-Mar-2018

229 views

Category:

Documents

13 download

Embed Size (px)

TRANSCRIPT

  • 10/15/15

    WonderwareInTouch HMI Scripting and Logic Guide

  • All rights reserved. No part of this documentation shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of Schneider Electric Software, LLC. No copyright or patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this documentation, the publisher and the author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein.The information in this documentation is subject to change without notice and does not represent a commitment on the part of Schneider Electric Software, LLC. The software described in this documentation is furnished under a license agreement. This software may be used or copied only in accordance with such license agreement.

    2015 Schneider Electric Software, LLC. All rights reserved.

    Schneider Electric Software, LLC26561 Rancho Parkway SouthLake Forest, CA 92630 U.S.A.(949) 727-3200http://software.schneider-electric.comFor comments or suggestions about the product documentation, send an e-mail message to ProductDocumentationComments@schneider-electric.com.

    ArchestrA, Avantis, DYNSIM, EYESIM, Foxboro, Foxboro Evo, I/A Series, InBatch, InduSoft, IntelaTrac, InTouch, PIPEPHASE, PRO/II, PROVISION, ROMeo, Schneider Electric, SIM4ME, SimCentral, SimSci, Skelta, SmartGlance, Spiral Software, VISUAL FLARE, WindowMaker, WindowViewer, and Wonderware are trademarks of Schneider Electric SE, its subsidiaries, and affiliated companies. An extensive listing of Schneider Electric Software, LLC trademarks can be found at: http://software.schneider-electric.com/legal/trademarks/. All other brands may be trademarks of their respective owners.

    http://www.wonderware.com

  • 3

    Contents

    Welcome ....................................................9Documentation Conventions ........................................................... 9Technical Support ............................................................................ 9

    Chapter 1 Introduction to Scripting ............................. 11Basic Scripting Concepts ............................................................... 12Types of Scripts .............................................................................. 12Editing and Creating Scripts ......................................................... 13Advanced Scripting Concepts ........................................................ 14

    OLE Objects ................................................................................. 14Scripting with ActiveX Controls ................................................. 14

    Chapter 2 Creating and Editing Scripts ........................ 15Opening a Script for Editing ......................................................... 16Saving or Discarding Changes to a Script .................................... 17Copying, Cutting and Pasting Text ............................................... 18Finding and/or Replacing Text ...................................................... 18Inserting Code Elements ............................................................... 18Accessing Help for Script Functions ............................................. 19Validating Scripts for Correct Syntax ........................................... 20Printing Scripts .............................................................................. 20

    InTouch HMI Scripting and Logic Guide

  • 4 Contents

    Deleting Scripts .............................................................................. 21

    Chapter 3 Script Triggers ........................................... 23Types of Script Triggers ................................................................. 24Using Multiple Triggers ................................................................. 24Periodic Script Execution .............................................................. 25Configuring Application Scripts .................................................... 25

    Limitations of Application Scripts ............................................. 26Configuring Window Scripts .......................................................... 27Configuring Key Scripts ................................................................. 28Configuring Condition Scripts ....................................................... 30Configuring Data Change Scripts ................................................. 33Configuring Action Scripts ............................................................ 34Configuring ActiveX Event Scripts ............................................... 38Pausing Script Execution at Run Time ......................................... 40

    $LogicRunning System Tag ........................................................ 41

    Chapter 4 The Script Language................................... 43Basic Syntax Rules ......................................................................... 44

    Subroutines ................................................................................. 44Statements ................................................................................... 44Indentation .................................................................................. 44Comments .................................................................................... 44Tag References ............................................................................ 45Literal Data Values ..................................................................... 45Value Expressions ....................................................................... 45Syntax Validation ........................................................................ 45

    Calling Standard Functions .......................................................... 46Syntax for Calling Standard Functions ..................................... 46Passing Parameters to a Function ............................................. 46

    Calling Custom Functions (QuickFunctions) ............................... 47Passing Parameters to a QuickFunction ................................... 48

    Value Assignments and Operators ................................................ 48Supported Operators ................................................................... 48Setting the Evaluation Order of Operators ............................... 56Implicit Data Type Conversion .................................................. 57Examples for Expressions ........................................................... 57

    Using Conditional Program Branching Structures ...................... 58Simple Conditional Structure ..................................................... 59Nested Conditional Structure ..................................................... 59Invalid Scripting Example (Missing ENDIF) ............................ 60

    InTouch HMI Scripting and Logic Guide

  • Contents5

    Invalid Scripting Example (Incorrect Nesting) ......................... 60Using Program Loops ..................................................................... 61

    Forcing the End of a Loop ........................................................... 62Effect of Loops on Other Run-Time Processes ........................... 63Time Limit for Loop Execution ................................................... 63Examples of Loops ....................................................................... 63

    Using Local Variables .................................................................... 64Declaring a Local Variable ......................................................... 64Naming Conflicts between Local Variables and Tags ............... 65

    Chapter 5 Custom Script Functions ............................. 67About QuickFunctions ................................................................... 67Configuring QuickFunctions ......................................................... 68Calling QuickFunctions ................................................................. 69Creating Asynchronous QuickFunctions ...................................... 70

    Limitations of Asynchronous QuickFunctions .......................... 70Checking if any Asynchronous QuickFunctions

    are Running ............................................................................ 70Stopping Asynchronous QuickFunctions from Running ........... 71

    Chapter 6 Built-In Functions....................................... 73Forcing Updates in Animation Display Links .............................. 73Mathematical Calculations ............................................................ 74

    Rounding, Truncating, and Determining Sign .......................... 74Using Trigonometric Functions .................................................. 77Returning the Value of Pi ........................................................... 80Calculating Logarithms .............................................................. 80Calculating the Square Root ....................................................... 82

    String Operations ........................................................................... 82Returning Parts of Strings ......................................................... 83Changing Case of Strings ........................................................... 85Removing Spaces from Strings ................................................... 86Formatting Strings with Spaces ................................................. 87Converting Between Characters and ASCII Codes ................... 87Searching and Replacing Text in Strings ..................

Recommended

View more >