Origin 6.1 LabTalk Developer's Guide OriginLab Corporation Copyright OriginLab,

Origin 6.1 LabTalk Developer's Guide OriginLab Corporation Copyright OriginLab, Origin, and LabTalk are either registered trademarks or trademarks of OriginLab Corporation. Microsoft, Windows, and Windows NT are registered trademarks of the Microsoft Corporation. 2000 OriginLab Corporation. All rights reserved. The software (including any images, "applets," photographs, animations, video, audio, music and text incorporated into the software) is owned by OriginLab Corporation or its suppliers and is protected by United States copyright laws and international treaty provisions. Therefore, you must treat the software like any other copyrighted material (e.g., a book or musical recording) except that you may either (a) make one copy of the software solely for backup or archival purposes, or (b) transfer the software to a single hard disk provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the software, nor print copies of any user documentation provided in "online" or electronic form. Grant of License This OriginLab Corporation End-User License Agreement ("License") permits you to use one copy of the OriginLab Corporation product Origin, which may include user documentation provided in "online" or electronic form ("software"), on any single computer, provided the software is in use on only one computer at any one time. If this package is a license pack, you may make and use additional copies of the software up to the number of licensed copies authorized. If you have multiple licenses for the software, then at any time you may have as many copies of the software in use as you have licenses. The software is "in use" on a computer when it is loaded into the temporary memory (i.e., RAM) or installed into the permanent memory (e.g., hard disk, CD-ROM, or other storage device) of that computer, except that a copy installed on a network server for the sole purpose of distribution to other computers is not "in use". If the anticipated number of users of the software will exceed the number of applicable licenses, then you must have a reasonable mechanism or process in place to ensure that the number of persons using the software concurrently does not exceed the number of licenses. OriginLab Corporation Technical Support Support hours are 8:30 A.M. to 6:00 P.M. EST. Users must have their Origin serial number and registration code ready. Users who have not yet registered with OriginLab Corporation should be prepared to register upon calling for technical support. 1-800-969-7720 (U.S. & Canada) OriginLab Corporation Tel: + 413-586-2013 One Roundhouse Plaza Fax: + 413-585-0126 Northampton, MA 01060 tech@originlab.com USA Contents Contents • • • • i Contents Getting Started 5 1.1 Introduction.........................................................................................................................5 1.2 How To Use This Manual...................................................................................................6 1.3 Manual Conventions ...........................................................................................................6 1.4 Quick Start Tutorials...........................................................................................................7 1.4.1 The Script Window............................................................................................8 1.4.2 Window Buttons ................................................................................................8 1.4.3 Script Files.......................................................................................................10 1.4.4 Macros .............................................................................................................13 Advanced Origin 15 2.1 Overview of Origin ...........................................................................................................15 2.1.1 Projects ............................................................................................................15 2.1.2 Child Windows ................................................................................................15 2.1.3 Datasets............................................................................................................16 2.1.4 Templates.........................................................................................................17 2.1.5 Graphs and Layers ...........................................................................................19 2.1.6 LabTalk............................................................................................................20 2.1.7 Curve Fitting....................................................................................................21 2.1.8 Origin's Window Objects.................................................................................22 2.2 Advanced Use of Layers ...................................................................................................28 2.2.1 Linked Layers ..................................................................................................29 2.2.2 Scaling .............................................................................................................33 2.3 Additional Tips .................................................................................................................36 2.3.1 Merging Pages .................................................................................................36 2.3.2 Extracting Layers to Separate Pages................................................................37 2.3.3 Extracting Data Plots to Separate Layers.........................................................37 2.3.4 Showing Only Every nth Symbol.....................................................................37 2.3.5 Using Datasets as a Plotting Enhancement ......................................................39 2.3.6 Using Escape Sequences to Format Labels......................................................45 2.3.7 View Modes.....................................................................................................46 Contents ii • • • • Contents 2.3.8 Updating the Display .......................................................................................46 2.3.9 Control Regions ...............................................................................................49 2.3.10 Screen Plotting Speed ....................................................................................50 2.3.11 Printing...........................................................................................................50 LabTalk 53 3.1 Introduction.......................................................................................................................53 3.2 Variables ...........................................................................................................................55 3.2.1 Numeric Variables ...........................................................................................55 3.2.2 String Variables ...............................................................................................56 3.2.3 Numeric to String Conversion..........................................................................57 3.2.4 Deleting Variables ...........................................................................................57 3.3 Operators...........................................................................................................................57 3.3.1 Arithmetic Operators........................................................................................57 3.3.2 Assignment Operators......................................................................................58 3.3.3 Logical and Relational Operators.....................................................................58 3.3.4 Bitwise Operators.............................................................................................59 3.3.5 Conditional Operators......................................................................................59 3.4 Calculations.......................................................................................................................60 3.4.1 Scalar Operations.............................................................................................60 3.4.2 Vector Operations............................................................................................60 3.4.3 Writing Speedy Calculations............................................................................66 3.5 Command Reference by Category.....................................................................................67 3.6 Object Reference by Category...........................................................................................71 3.7 Control Flow .....................................................................................................................75 3.7.1 Statements and Statement Blocks.....................................................................75 3.7.2 Break Command ..............................................................................................77 3.7.3 Continue Command .........................................................................................77 3.7.4 Doc Command .................................................................................................78 3.7.5 For Command ..................................................................................................79 3.7.6 If Command .....................................................................................................80 3.7.7 Layer -o Command ..........................................................................................81 3.7.8 Loop Command................................................................................................81 3.7.9 Repeat Command.............................................................................................82 3.7.10 Run Object Methods ......................................................................................82 3.7.11 Switch Command...........................................................................................83 3.7.12 Win -o Command...........................................................................................84 3.8 Passing Arguments............................................................................................................84 3.8.1 Passing Numeric Variables by Reference ........................................................85 3.8.2 Passing Numeric Variables by Value...............................................................86 3.9 Input ..................................................................................................................................87 3.9.1 Getnumber Command ......................................................................................87 3.9.2 Getpts Command..............................................................................................88 Contents Contents • • • • iii 3.10 Output .............................................................................................................................92 3.10.1 Literal Strings ................................................................................................92 3.10.2 Object's Text Property ...................................................................................94 3.10.3 Customizing Output Using the Type Command and Escape Sequences........94 3.10.4 Formatted Output with $( ) ............................................................................95 3.10.5 Redirecting Output to the Notes Window......................................................96 3.10.6 Redirecting Output to the Results Log...........................................................97 3.11 Useful Built-in Functions ................................................................................................98 3.11.1 Data Function.................................................................................................99 3.11.2 Exist Function................................................................................................99 3.11.3 Int Function..................................................................................................100 3.11.4 List Function................................................................................................100 3.11.5 Mod Function...............................................................................................100 3.11.6 Sqrt Function ...............................................................................................101 3.11.7 Sum Function...............................................................................................101 3.11.8 Table Function.............................................................................................101 3.11.9 Xof Function................................................................................................102 3.11.10 Xvalue Function.........................................................................................102 3.12 Macros ..........................................................................................................................102 3.13 Worksheet Tips .............................................................................................................104 3.13.1 Missing Values ............................................................................................104 Application Development 105 4.1 Introduction.....................................................................................................................105 4.2 The LabTalk Development Environment........................................................................106 4.3 Developing Script Files with the LabTalk Editor............................................................109 4.4 Running Script Files........................................................................................................111 4.4.1 Running Script from a Custom Toolbar Button .............................................111 4.4.2 Running Script from the Custom Routine Button on the Standard Toolbar...115 4.4.3 Running Script from the Label Control Dialog Box of an Object..................115 4.4.4 Running Script from New Menu Items (Commands).....................................117 4.4.5 Running Script from the Script Window........................................................118 4.4.6 Creating Templates for Your Custom Applications.......................................118 4.4.7 Useful Child Window Scripting Tips.............................................................119 4.5 Debugging Your Script ...................................................................................................120 4.5.1 The LabTalk Debugger..................................................................................120 4.5.2 The Echo System Variable.............................................................................121 4.5.3 The List Command ........................................................................................122 4.5.4 Tracking Values of Variables ........................................................................122 4.5.5 The #!script Notation.....................................................................................122 4.5.6 Checking Variable Values at Breakpoints .....................................................123 4.6 Building Applications with OriginPro.............................................................................124 4.7 Distributing Your Custom Applications..........................................................................124 Contents iv • • • • Contents 4.7.1 Creating the Export (.OPK) File ....................................................................125 4.7.2 Installing the .OPK File .................................................................................127 4.7.3 Exchanging Your Custom Application on the OriginLab Web Site...............128 Index 129 Chapter 1, Getting Started 1.1 Introduction • • • • 5 Getting Started 1.1 Introduction Origin®-based applications can be constructed for many purposes. For example, you can create applications to handle statistical process control, analyze pharmaceutical data, control sophisticated data acquisition devices, and even to evaluate eyesight! Though each of these applications address specialized data analysis and plotting needs, in each case it is the Origin software that serves as the foundation for the custom- designed scientific application. The LabTalk Developer’s Guide provides tips to assist you in building your own well-written Origin application. However, this manual is not intended as an Origin or LabTalk® reference. Nor is it intended as a reference for the development tools available with OriginPro. For assistance using Origin, see the Origin User’s Manual or the Origin Help file. For reference information on LabTalk, see the LabTalk Manual or the LabTalk Help file. To learn about the development tools available with OriginPro, see the OriginPro Manual. 1 Chapter 1, Getting Started 6 • • • • 1.2 How To Use This Manual 1.2 How To Use This Manual • The Quick Start tutorials at the end of this chapter illustrate some of the ways that you can run LabTalk scripts in Origin. In just a few minutes, you'll learn different script execution methods to output Hello World to an Attention dialog box. • Chapter 2 provides a brief overview of Origin. It also includes advanced Origin issues and tips that are often included in custom applications. • Chapter 3 surveys the LabTalk language, focusing on issues of particular interest to the application developer. These issues include the use of variables, operators, calculations, control flow statements, input and output, built-in functions, and macros. • Chapter 4 guides you through the process of developing a custom application. Detailed examples are provided illustrating different script execution methods. Debugging methods are discussed. Information is provided on building custom applications using OriginPro tools. Additionally, information is provided on creating and exchanging your custom tools with other Origin users. 1.3 Manual Conventions Table 1.1 lists the documentation conventions observed in the LabTalk Developer’s Guide. Table 1.1: Documentation Conventions Convention Description Plot:Graph Type Layer n dialog box Italicized text indicates the information is not literal. Rather, the italicized text serves as a placeholder for literal text. Supply or interpret the appropriate literal text. For example, Plot:Scatter. (Note: Text may also be italicized for emphasis. This difference should be clear by context.) Chapter 1, Getting Started 1.4 Quick Start Tutorials • • • • 7 Convention Description Data1_A The names of datasets are displayed in bold. Window:Script Window Menu commands are displayed in bold. Levels are separated by a colon. ORIGIN61.EXE File names are displayed in uppercase characters. TAB Keyboard keys are displayed in uppercase characters. Script Arial + bold font indicates LabTalk script that can be entered verbatim. Syntax Used with LabTalk. Italicized + bold font indicates a user-supplied argument that cannot be entered verbatim. Serves as a placeholder for literal text. Usually used in syntax examples. [ ] Used with LabTalk. Items in brackets are optional. ( ) Used with LabTalk. uploads/Geographie/ labtalk-guide.pdf

  • 28
  • 0
  • 0
Afficher les détails des licences
Licence et utilisation
Gratuit pour un usage personnel Attribution requise
Partager