You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
<doc> <legacy_id>2403</legacy_id> <name>do</name> <type>command</type> <syntax> <example>do <i>statementList</i> </example> <example>do <i>statementList</i> in <i>caller</i> </example> <example>do <i>statementList</i> as a<i>lternateLanguageName</i></example> </syntax> <synonyms> </synonyms> <summary><glossary tag="execute">Executes</glossary> a list of <glossary tag="statement">statements</glossary>.</summary> <examples><example>do "go next card"</example><example>do "put" && x && "into tNumberOfRecords" & x -- might become "put 3 into tNumberOfRecords"</example><example>do "select" && line 3 of field "Objects"</example><example>do field "Statements" as AppleScript</example> </examples> <history> <introduced version="1.0">Added.</introduced> <deprecated version=""></deprecated> <removed version=""></removed> <changed version="6.0">6.0</changed><changed version="2.9">2.9</changed> <experimental version=""></experimental> <nonexperimental version=""></nonexperimental> </history> <objects> </objects> <platforms> <mac/> <windows/> <linux/> <ios/> <android/> </platforms> <classes> <desktop/> <server/> <web/> <mobile/> </classes> <security> </security> <classification> <category>Writing LiveCode</category> <category>Standalone Applications</category> </classification> <references> <function tag="alternateLanguages">alternateLanguages Function</function> <command tag="call">call Command</command> <command tag="debugDo">debugDo Command</command> <command tag="local">local Command</command> <command tag="breakpoint">breakpoint Command</command> <keyword tag="message box">message box Keyword</keyword> <keyword tag="as">as Keyword</keyword> </references> <description> <overview>Use the <b>do</b> 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.</overview> <parameters> <parameter> <name>statementList</name> <description>A LiveCode statement, a container with one or more statements, or a string that evaluates to a statement.</description> </parameter> <parameter> <name>alternateLanguageName</name> <description>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.</description> </parameter> <parameter> <name>caller</name> <description>Has the effect of executing the statementList in the context of the handler.</description> </parameter> </parameters> <value></value> <comments>Using the <b>do</b> <glossary tag="command">command</glossary> is slower than directly <glossary tag="execute">executing</glossary> the <glossary tag="command">commands</glossary>, because each <glossary tag="statement">statement</glossary> must be <glossary tag="compile">compiled</glossary> every time the <b>do</b> <glossary tag="command">command</glossary> is executed.<p></p><p>On Mac OS X systems, if you use the do as a<i>lternateLanguageName</i> form, any result returned by the script language is placed in the <function tag="result">result</function>.</p><p></p><p>On Windows systems, the <function tag="result">result</function> 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":</p><p></p><p>do "result = 1 + 1" as "vbscript"</p><p>answer the result</p><p></p><p></p><important> If using the do as <i>alternateLanguageName</i> form, any paths used in the <i>statementList</i> 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.</important><p></p><p>When using a standalone application created by LiveCode, you can include up to ten statements in the <i>statementList</i>. This limit is set by line 2 of the <function tag="scriptLimits">scriptLimits</function> <control_st tag="function">function</control_st>. This limitation does not apply when using the <glossary tag="development environment">development environment</glossary>.</p><p></p><p></p><note> The ten-statement limit in standalones applies only if the <i>statementList</i> is written in <glossary tag="LiveCode">LiveCode</glossary>. If you specify an <i>alternateLanguageName</i> this limit does not apply.</note><p></p><p>If you attempt to specify an <i>alternateLanguageName</i> on a <glossary tag="Unix">Unix</glossary> <glossary tag="Windows">system</glossary>, the <b>do</b> <glossary tag="command">command</glossary> is not executed, and the <function tag="result">result</function> is set to "alternate language not found".</p><p></p><p>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 <function tag="result">result</function> variable instead of using WScript.Echo.</p><p></p><p>To see how to create a numbered set of variables see the dictionary entry for the <command tag="local">local command</command>.</p><p></p><p></p><change><p>The <i>alternateLanguageName</i> option was introduced in version 1.1. In previous versions, it was not possible to include AppleScript or other <glossary tag="Open Scripting Architecture (OSA)">OSA</glossary> languages in a <glossary tag="LiveCode">LiveCode</glossary> <glossary tag="handler">handler</glossary>.</change><p></p><p>The ability to specify an <i>alternateLanguageName</i> on Windows systems was added in LiveCode 2.9.</p><p>	</p></comments> </description></doc>
1
+
<doc>
2
+
<legacy_id>2403</legacy_id>
3
+
<name>do</name>
4
+
<type>command</type>
5
+
6
+
<syntax>
7
+
<example>do <i>statementList</i> </example>
8
+
<example>do <i>statementList</i> in <i>caller</i> </example>
9
+
<example>do <i>statementList</i> as a<i>lternateLanguageName</i></example>
10
+
</syntax>
11
+
12
+
<synonyms>
13
+
</synonyms>
14
+
15
+
<summary><glossarytag="execute">Executes</glossary> a list of <glossarytag="statement">statements</glossary>.</summary>
16
+
17
+
<examples>
18
+
<example>do "go next card"</example>
19
+
<example>do "put" x "into tNumberOfRecords" x -- might become "put 3 into tNumberOfRecords"</example>
20
+
<example><p>do "select" line 3 of field "Objects"</p></example>
21
+
<example>do field "Statements" as AppleScript</example>
<overview>Use the <b>do</b> 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.</overview>
73
+
74
+
<parameters>
75
+
<parameter>
76
+
<name>statementList</name>
77
+
<description>A LiveCode statement, a container with one or more statements, or a string that evaluates to a statement.</description>
78
+
</parameter>
79
+
<parameter>
80
+
<name>alternateLanguageName</name>
81
+
<description>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.</description>
82
+
</parameter>
83
+
<parameter>
84
+
<name>caller</name>
85
+
<description>Has the effect of executing the statementList in the context of the handler.</description>
86
+
</parameter> </parameters>
87
+
88
+
<value></value>
89
+
<comments>Using the <b>do</b> <glossary tag="command">command</glossary> is slower than directly <glossary tag="execute">executing</glossary> the <glossary tag="command">commands</glossary>, because each <glossary tag="statement">statement</glossary> must be <glossary tag="compile">compiled</glossary> every time the <b>do</b> <glossary tag="command">command</glossary> is executed.<p></p><p>On Mac OS X systems, if you use the do as a<i>lternateLanguageName</i> form, any result returned by the script language is placed in the <function tag="result">result</function>.</p><p></p><p>On Windows systems, the <function tag="result">result</function> 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":</p><p></p><p>do "result = 1 + 1" as "vbscript"</p><p>answer the result</p><p></p><p></p><important>If using the do as <i>alternateLanguageName</i> form, any paths used in the <i>statementList</i> 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.</important><p></p><p>If you attempt to specify an <i>alternateLanguageName</i> on a <glossary tag="Unix">Unix</glossary> <glossary tag="Windows">system</glossary>, the <b>do</b> <glossary tag="command">command</glossary> is not executed, and the <function tag="result">result</function> is set to "alternate language not found".</p><p></p><p>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 <function tag="result">result</function> variable instead of using WScript.Echo.</p><p></p><p>To see how to create a numbered set of variables see the dictionary entry for the <command tag="local">local command</command>.</p><p></p><p></p><change><p>The <i>alternateLanguageName</i> option was introduced in version 1.1. In previous versions, it was not possible to include AppleScript or other <glossary tag="Open Scripting Architecture (OSA)">OSA</glossary> languages in a <glossary tag="LiveCode">LiveCode</glossary> <glossary tag="handler">handler</glossary>.</change><p></p><p>The ability to specify an <i>alternateLanguageName</i> on Windows systems was added in LiveCode 2.9.</p><p>	</p><p>	</p></comments>
<description>Use the <b>edit</b> <glossarytag="command">command</glossary> in the <glossarytag="development environment">development environment</glossary> to open the LiveCode <glossarytag="script editor">script editor</glossary> with the <propertytag="script">script</property> of the specified <glossarytag="object">object</glossary>.<p></p><p><b>Parameters:</b></p><p>The <i>object</i> is any object reference.</p><p>Usint the optional at syntax will pass the subsequent items to the editScript handler as a second parameter. By convention the first two parameters should be a line number and a column character offset from the start of the line.</p><p></p><p><b>Comments:</b></p><p>The <b>edit</b> <glossarytag="command">command</glossary> is equivalent to selecting the object and choosing Object menuObject Script<important>. If the script ed is not open, the <b>edit</b> command opens a window that shows the script.</important></description>
61
+
<description>Use the <b>edit</b> <glossarytag="command">command</glossary> in the <glossarytag="development environment">development environment</glossary> to open the LiveCode <glossarytag="script editor">script editor</glossary> with the <propertytag="script">script</property> of the specified <glossarytag="object">object</glossary>.<p></p><p><b>Parameters:</b></p><p>The <i>object</i> is any object reference.</p><p>Usint the optional at syntax will pass the subsequent items to the editScript handler as a second parameter. By convention the first two parameters should be a line number and a column character offset from the start of the line.</p><p></p><p><b>Comments:</b></p><p>The <b>edit</b> <glossarytag="command">command</glossary> is equivalent to selecting the object and choosing Object menu then Object Script.</p><p></p><p></p><important>. If the script editor is not open, the <b>edit</b> command opens a window that shows the script.</important></description>
0 commit comments