EXECUTE command

Used to execute an application or process external to ACL. Emulates the Windows Run command. Can be used to interact with the Windows command prompt.

Note

Because the EXECUTE command gives you the ability to interact with the operating system and applications external to ACL, technical issues may arise that are beyond the scope of ACL's native functionality. ACL Support Services can assist with operation of the EXECUTE command inside ACL, but issues that arise with processes and applications external to ACL are not covered under Support Services.

Syntax

EXECUTE Windows_Run_command_syntax <ASYNC>

Parameters

Windows_Run_command_syntax

Specifies the name of the application to execute, the folder or file to open, or the command to run, and any required arguments or command switches. The parameter requires valid Windows Run command syntax enclosed by quotation marks.

ASYNC

Optional. Specifies asynchronous mode. In asynchronous mode, the process started by the EXECUTE command runs at the same time as ACL and at the same time as any subsequent ACLScript commands. If you use EXECUTE from the ACL command line, you must specify ASYNC.

If you do not specify ASYNC, the default synchronous mode is used in which any process started by the EXECUTE command must complete before the next line in an ACL script executes, or the next process begins, and ACL is inaccessible while external processes are running.

ACL output variables

RETURN_CODE

Stores the code returned by an external application or process run using the EXECUTE command.

Return codes are numbers generated by the external application or process and sent back to ACL to indicate the outcome of the external process. ACL does not generate the return code.

Typical return codes are integer values that map to specific notifications or error messages. For example, the return code “0” could mean “The operation completed successfully”. The return code “2” could mean “The system cannot find the file specified”.

Specific return codes and their meanings vary depending on the external application or process. Lists of return codes, also called ‘error codes’ or ‘exit codes’, and their meanings, can often be found in the documentation for the associated external application. Lists of return codes can also be found on the Internet.

The RETURN_CODE variable is created when the command is used synchronously, but not when the command is used asynchronously.

Remarks

The EXECUTE command allows you to run Windows and DOS commands from the ACL command line or from an ACL script. You can use this ability to increase the automation of ACL scripts by performing a variety of useful tasks that are not possible using ACLScript syntax alone:

Specific details of how to perform any of these tasks are beyond the scope of the ACL Language Reference. For assistance, consult appropriate Windows operating system documentation, or other third-party documentation.

Additional details:

Examples

Task

Syntax

Open an application

EXECUTE "Excel"

EXECUTE "AcroRd32.exe"

Close an application

EXECUTE "TASKKILL /f /im Excel.exe"

Note

Use the ‘/f’ switch with caution. It forces an application to close without presenting any dialog boxes, such as those for saving changes.

Open a file

EXECUTE '"C:\ACL Projects\Source Data\AP_Trans.xlsx"'

Create a new folder

EXECUTE 'cmd /c MD "C:\ACL Projects\Source Data"'

Run external scripts or non-ACL batch files (.bat)

EXECUTE '"C:\ACL Projects\Batch Files\My_Batch.bat"'

Pass parameters to a non-ACL batch file

EXECUTE '"C:\ACL Projects\Batch Files\My_Batch.bat" param1 %v_param2%'

Parameters can be literals or ACL variables.

Run ACL scripts in other ACL projects

EXECUTE 'aclwin.exe "C:\ACL Projects\AP Trans Tests.acl" /b AP_Trans_script'

Note

Running an ACL script in another project launches a second instance of ACL. The script in the second project should end with the QUIT command so that the second instance of ACL closes and control is returned to the initial instance of ACL.

Incorporate a waiting period in an ACL script

EXECUTE "TIMEOUT /t 30"

or

EXECUTE "cmd /c PING -n 31 127.0.0.1 > nul"

Both examples create a waiting period of 30 seconds.



(C) 2015 ACL Services Ltd. All Rights Reserved.