procedure StartScript;
Begins executing the script in the background.
StartScript checks the internal table of compiled commands. If that table is empty, it calls PrepareScript to compile the commands in the file specified by ScriptFile. If ScriptFile is empty, PrepareScript tries to compile the list of commands specified by ScriptCommands. If that list is also empty, the EApxScriptError exception is raised.
If StartScript finds or creates a list of compiled commands, it begins executing those commands. It continues executing commands until it encounters a command requiring a "wait" (WAIT, WAITMULTI, UPLOAD, DOWNLOAD). It then sets up appropriate triggers and trigger handlers and exits back to the application. When the triggers occur, the script engine regains control in the background and continues executing until the next wait command, when this process is repeated.