This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathdo.lcdoc
More file actions
103 lines (77 loc) · 3.57 KB
/
Copy pathdo.lcdoc
File metadata and controls
103 lines (77 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
Name: do
Type: command
Syntax: do <statementList>
Syntax: do <statementList> in <caller>
Syntax: do <statementList> as <alternateLanguageName>
Summary:
<execute|Executes> a list of <statement|statements>.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
do "go next card"
Example:
do "put" && x && "into tNumberOfRecords"
-- might become "put 3 into tNumberOfRecords"
Example:
do "select" && line 3 of field "Objects"
Example:
do field "Statements" as AppleScript
Parameters:
statementList:
A LiveCode statement, a container with one or more statements, or a
string that evaluates to a statement.
caller:
Has the effect of executing the statementList in the context of the
handler.
alternateLanguageName:
On Mac OS and OS X systems, the alternateLanguageName is a script
language (such as AppleScript) supported under the Open Scripting
Architecture. On Windows systems, the alternateLanguageName is an
"active scripting" language (such as VBScript) supported by the Windows
Scripting Host. The available languages are returned by the
alternateLanguages function. If you specify an alternateLanguageName,
the statementList must be written in the specified language.
The result:
On Mac OS X systems, if you use the do as a <lternateLanguageName> form,
any result returned by the script language is placed in the <result>. On
Windows systems, the <result> function will return the value of the
global variable called "result" in the script that was executed (or
empty if no such variable was defined). For example the following code
will produce a dialog box containing "2":
do "result = 1 + 1" as "vbscript"
answer the result
If you attempt to specify an <alternateLanguageName> on a <Unix> <system>, the
<do> <command> is not executed, and the <result> is set to
"alternate language not found". Any scripts on Windows which contain
references to WScript will fail to run as WScript objects do not exist
in the LiveCode Environment. Return values should therefore be placed
within the global <result> variable instead of using WScript.Echo.
Description:
Use the <do> command to execute statements in a container, or to execute
a statement that consists partly of a literal string and partly of a
container or the return value from a function.
Using the <do> <command> is slower than directly <execute|executing> the
<command|commands>, because each <statement> must be <compile|compiled>
every time the <do> <command> is executed.
>*Important:* If using the do as <alternateLanguageName> form, any paths
> used in the <statementList> must be in the native format of the
> current system. In particular this means that paths must be converted
> to Windows native format before use on Windows machines. In most cases
> this can be done by replacing slash with backslash in the path.
To see how to create a numbered set of variables see the dictionary
entry for the <local> <command>.
The ability to specify an <alternateLanguageName> on Windows systems was
added in LiveCode 2.9.
Changes:
The <alternateLanguageName> option was introduced in version 1.1. In
previous versions, it was not possible to include AppleScript or other
<Open Scripting Architecture|OSA> languages in a <LiveCode>
<handler>.
References: debugDo (command), breakpoint (command), local (command),
call (command), result (function),
alternateLanguages (function), LiveCode (glossary),
handler (glossary), execute (glossary), statement (glossary),
Unix (glossary), compile (glossary), command (glossary),
Open Scripting Architecture (glossary), message box (keyword),
as (keyword), system (keyword)