Please enable JavaScript to view this site.

ESL Documentation

Action Statement

Save the current state of a program.

save program as PROGRAM_NAME

PROGRAM_NAME

A string value representing the name, including the extension, of the file in which you want the program stored.

Description

Use this statement to save the current state of an ESL program, with the changes made during execution, to a new ESL binary program file.

Before using the save program as statement, all dialog regions and dialog boxes must be made temporary and invisible.

The save program as statement copies the program, in its current state, to a new program. All objects are saved with their current appearance, attributes, and text and graphics cursor positions; local and global variables are saved with their current values.

The old program still exists as it was written, and still continues to run until an exit or change to program statement is executed. The new program, as amended during execution, has been saved in a new file, identified by the specified value for PROGRAM_NAME.

The save program as statement can only be called directly from a response, or from an action routine that is called directly from a response. It should never be called from a subroutine or from an action routine that is called from a subroutine.

If you specify a program name that already exists, the saved program will overwrite the original file. The saved program does not have to be in the current directory; you can specify a full pathname for it. When specifying a path as a string constant, include an extra backslash each time one is specified (since a single backslash is the escape character within strings).

Global and Local Values in a Saved Program

When you save a program with a save program as statement, the values of all global and local variables are saved with it. But if you transfer control to a program that was previously saved, the global variables retain the values they had in the program from which control was transferred.

Dialog Control Objects

When you save a program with a save program as statement, the current state of dialog controls is not saved. For example, if text has been entered into or deleted from an entry field, a list box has been scrolled, and a check box has been checked before a save program as statement, these changes will not be reflected in the saved program when it is run.

Like other ESL objects, however, any programmatic changes to a control's attributes (such as size, position, text) will be saved. If no programmatic changes have been made to the control, its initial state will be saved.

Action Bars

A save program as statement will not save user selection of or programmatic changes to action bar items. For example, the addition/deletion, checking/unchecking, enabling/disabling, and changing text of action bar items is not saved.

Tables

Note that, while the definition of each table in your program is saved, the rows in them are not saved. When the saved program is run, ESL loads the table only with the columns and attributes in effect when it was saved, but with no rows.

Example

 

response to End

 save program as "report"

 

action SaveMe is

 save program as Name

 

response to StopSign

 save program as "c:\\esl\\data\\second"

 

response to Small

 add to Design at position 100 150

 box 50 50

 save program as "Display"

 change to program "Show"