2013م - 1444هـ 85
Scripting Guide
Scripting Guide
Contents
Introduction
A Quick Example of Scripting in AutoPlay Media Studio
Important Scripting Concepts
Script is Global
Script is Case-Sensitive
Comments
Delimiting Statements
Variables
What are Variables?
Variable Scope
Local Variables
Variable Naming
Reserved Keywords
Types and Values
Number
String
Nil
Boolean
Function
Table
Variable Assignment
Expressions and Operators
Arithmetic Operators
Relational Operators
Logical Operators
The Length Operator
Concatenation
Operator Precedence
Control Structures
If
While
Repeat
For
Tables (Arrays)
AutoPlay Media Studio 8
86
Creating Tables
Accessing Table Elements
Numeric Arrays
Associative Arrays
Using For to Enumerate Tables
Copying Tables
Table Functions
Functions
Function Arguments
Returning Values
Returning Multiple Values
Redefining Functions
Putting Functions in Tables
String Manipulation
Concatenating Strings
Comparing Strings
Counting Characters
Finding Strings
Replacing Strings
Extracting Strings
Converting Numeric Strings into Numbers
Other Built-in Functions
Script Functions
dofile
require
type
Actions
Debugging Your Scripts
Error Handling
Syntax Errors
Functional Errors
Debug Actions
Application.GetLastError
Debug.ShowWindow
Debug.Print
Debug.SetTraceMode
Debug.GetEventContext
Dialog.Message
Final Thoughts
Other Resources
Scripting Guide
87
Help File
User’s Guide
AutoPlay Media Studio Web Site
Indigo Rose Technical Support
The Lua Web Site
Introduction
Introduction
One of the powerful features of AutoPlay Media Studio is its scripting engine. This document
will introduce you to the new scripting environment and language.
AutoPlay scripting is very simple, with only a handful of concepts to learn. Here is what it looks
like:
a = 5;
if a < 10 then
Dialog.Message("Guess what?", "a is less than 10"
;
end
(Note: this script is only a demonstration. Don’t worry if you don’t understand it yet.)
The example above assigns a value to a variable, tests the contents of that variable, and if the
value turns out to be less than 10, uses an AutoPlay action called “Dialog.Message” to display a
message to the user.
New programmers and experienced coders alike will find that AutoPlay Media Studio is a
powerful, flexible yet simple scripting environment to work in.
A Quick Example of Scripting in AutoPlay Media Studio
Here is a short tutorial showing you how to enter a script into AutoPlay Media Studio and
preview the results:
1.
Start a new project.
2.
Create a new button object.
3.
In the Actions category of the properties pane, click on the On Click event. A small edit button
should appear next to the word “-- None --” on the right.
i
ed a Web Browser Window......
يمكنك تحميله من خلال الدخول الى صفحه التحميل من