MS Script System Variables

                

Expand/Collapse all Show/Hide All

When an MS Script is run, the Customizer module passes several system variables to the script processor. For example, a script can use the following variables to condition logic based on user code or company code. The variable names begin with MAS_, followed by SCR_ (for script) and conclude with a descriptive code, for example, CMP (for company).

Expand/Collapse item  System Variables Passed to Script

The following variables are passed to the script processor, but are not returned to the software.

MAS_SCR_CMP

string

Company code [XXX]

MAS_SCR_USR

string

User code [XXX]

MAS_SCR_MOD

string

Module code [X/X]

MAS_SCR_DTE

string

Module date [YYYYMMDD]

MAS_SCR_HWD

string

Sage 100 home folder [HWD]

MAS_SCR_LWD

string

Sage 100 current working folder [LWD]

MAS_SCR_LIB

string

Nomads library [ ../xx/xxxxxxxx.LIB]

MAS_SCR_PNL

string

Nomads panel [ PNL_xxxxxx ]

MAS_SCR_OBJ

string

Nomads control [ BT_LINK_x ]

MAS_SCR_CS

number

Set to 1 if running under a Sage 100 Advanced client (WindX)

 

Expand or collapse item System Variables Returned From a Script

System variables can be set within the script to pass information back to the Customizer module. They can be placed anywhere in the script and must follow the syntactical conventions of the specified script language.

Variables

Convention

Description

MAS_SCR_DBG

number

If non-zero, the Customizer module displays the script before it is executed and then displays the script results after it is executed.

MAS_SCR_PRG

string

If non-null, the Customizer module displays a progress dialog box containing this string before executing the script, and then automatically closes the progress dialog box after running the script. This is helpful for scripts that do not have a user interface and take more than a second or two to execute. The progress meter can display in any Sage 100 environment, whether or not the script is run from a server.

When the progress dialog box is initialized, the progress bar displays 25 percent complete and before the dialog box is closed the message bar displays 100 percent complete. During script execution, the progress meter cannot be updated.

The dialog box title defaults to "Script in Progress", but can be overridden by placing the title at the end of the MAS_SCR_PRG string following a tilde (~). For example, "One moment please…~Running Budget Script" displays the message "One moment please…" with the dialog box title "Running Budget Script".

MAS_SCR_ERR

number

If non-zero, the Customizer module does not retrieve the return variables. This instructs the Customizer module that it should not attempt to retrieve variables that were set during script execution. For example, if ML_BALANCE had its value calculated by the script and it was specified to be returned to Sage 100, but a condition occurred during script processing which caused the script to abort without passing back any values, the script’s abort routine can set MAS_SCR_ERR=1 and the Customizer module would not retrieve ML_BALANCE and other return variables.

MAS_SCR_MSG

string

If non-null, the Customizer module displays a dialog box containing this string after the script is done executing. This can be used for a warning or any other purpose; for example, the messages "VB Script Failed Due to an Error" or "Fax successfully sent" can display. The message can display in any Sage 100 environment. For example, a message can be displayed on a client even if the script is run on the server. This frees the script from having to display an error or success message on the server.

The dialog box title defaults to "Script Message", but can be overridden by placing the title at the end of the MAS_SCR_MSG string following a tilde (~). For example, "Hello, world~Best" displays the message "Hello, world" with the dialog box title "Best".

This variable functions independently of the above error return variable. That is, even if the MAS_SCR_ERR value is non-zero, the Customizer module retrieves the value of MAS_SCR_MSG and displays the message if it is not null.

MAS_SCR_PFM

string

Master Developer ONLY. This string contains a program label that is called via PERFORM after the script executes. This option gives Master Developers a hook for performing post-script calculations or for interacting with the Nomads panel.