Error getting tags :
error 404Error getting tags :
error 404 do | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Expander triangle

do statementList [as alternateLanguageName]

Desktop, Web and Server
Platform Support
Mac OS X,Windows,Linux
None required
Executes a list of statements.

do "go next card"
do "put" && x && "into tNumberOfRecords" & x -- might become "put 3 into tNumberOfRecords"
do "select" && line 3 of field "Objects"
do field "Statements" as AppleScript

Additional Comments
Expander triangle

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.


The statementList is a Revolution statement, a container with one or more statements, or a string that evaluates to a statement.

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.


Using the do command is slower than directly executing the commands, because each statement must be compiled every time the do command is executed.

On Mac OS X systems, if you use the do as alternateLanguageName 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

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.

When using a standalone application created by Revolution, you can include up to ten statements in the statementList. This limit is set by line 2 of the scriptLimits function. This limitation does not apply when using the development environment.

Note: The ten-statement limit in standalones applies only if the statementList is written in Revolution. If you specify an alternateLanguageName this limit does not apply.

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 Revolution Environment. Return values should therefore be placed within the global result variable instead of using WScript.Echo.

To see how to create a numbered set of variables see the dictionary entry for the local command.

Changes to Revolution:

The alternateLanguageName option was introduced in version 1.1. In previous versions, it was not possible to include AppleScript or other OSA languages in a Revolution handler.

The ability to specify an alternateLanguageName on Windows systems was added in Revolution 2.9.

User Comments
Expander triangle
User thumbnail
Apr 26, 2010
To call a javascript in a browser use:
do "myfunction(myparam1,myparam2);" in browser #result from javascript will be in result if the result = true then beep
Here's an example javascript. Note you can return value <html> <head> <script type="text/javascript"> function helloWorld(hello1){ alert(hello1); return true; } </script> </head>