XScript Manual · Chapter 53
Parameters — JF · SS · MS · RD
Scripts read and write the parameters defined on the JobFile Setup, System Setup and Master Setup screens directly as prefix.Name.
Use them when a value that changes per model (JobFile) or is fixed per machine (System / Master Setup) should be changed on screen
in the field instead of being written into the script as a number.
Prefixes
| Prefix | Target | Save to file |
|---|---|---|
JF. | JobFile parameters — values of the JobFile currently open. Saved separately for each JobFile | SYS.SaveJobFileParam() |
SS. | System Setup parameters — machine setup | SYS.SaveSetupParam() |
MS. | Master Setup parameters | SYS.SaveMasterParam() |
RD. | RUN data parameters | SYS.SaveRunParam() |
Parameters are added and their values edited in the grids of the JobFile Setup, System Setup and Master Setup screens.
Pressing the left Ctrl+C on a parameter row copies the name used in scripts (e.g. JF.PrintSpeed).
Basic example
xscript
FUNCTION UpdateDeviceSize(double sizeX)
{
// Read the JobFile (JF) value; if it differs, change it and save the file
double devX = JF.DeviceSizeX;
if( devX != sizeX )
{
JF.DeviceSizeX = sizeX;
SYS.SaveJobFileParam();
}
// Toggle a System Setup (SS) value and save it
if( SS.TransferXSafetyCheck == true )
{
SS.TransferXSafetyCheck = false;
}
else
{
SS.TransferXSafetyCheck = true;
}
SYS.SaveSetupParam();
return true;
}Reading and writing
- Reading — a value changed on a parameter screen is read by scripts right away, even before [Save]. The script reads the same value the screen shows.
- Writing —
JF.Name = valuechanges the value in memory and on the screen. Reading it right after returns the written value. To keep it in the file, call the save function (table above). Without saving, the previous value comes back when the program restarts. - Type — the value read follows the parameter's data type (Integer · Double · Bool · String).
Handling names as strings ( SYS functions )
There are also SYS functions that take the parameter name as a string. Give the name with its prefix ("SS.CamCalibX").
| Signature | Description |
|---|---|
bool SetParamValue(string dataName, int|double|bool|string value) | Sets a parameter value. To keep it in the file, save with SaveParam or SaveSingleParam |
bool GetParamValue(string dataName, ref int|double|bool|string value) | Reads a parameter value |
bool SaveSingleParam(string dataName) | Saves only one parameter to the file. Unsaved values of other parameters being edited are left as they are |
bool SaveParam(string managerKey) | Saves one group. "JF" · "SS" · "MS" · "RD" (a name such as "SS.Name" also saves that whole group) |
bool LoadParam(string managerKey) | Reloads one group from the file. "JF" · "SS" · "MS" · "RD" |
bool SaveJobFileParam() · bool LoadJobFileParam() | Save · reload the JobFile parameters |
bool SaveSetupParam() · bool LoadSetupParam() | Save · reload the System Setup parameters |
bool SaveMasterParam() · bool LoadMasterParam() | Save · reload the Master Setup parameters |
bool SaveRunParam() · bool LoadRunParam() | Save · reload the RUN data |
xscript
FUNCTION SaveSpeedOnly(double speed)
{
// Change one value and save only that value to the file
if( SYS.SetParamValue("JF.PrintSpeed", speed) == false )
{
return false;
}
return SYS.SaveSingleParam("JF.PrintSpeed");
}
FUNCTION ReadSpeed()
{
double speed = 0;
if( SYS.GetParamValue("JF.PrintSpeed", /*ref*/speed) == false )
{
LogError("JF.PrintSpeed not found");
return false;
}
Log("PrintSpeed = {0}", speed);
return true;
}SaveJobFileParam()also saves the JobFile vision tool information, andSaveSetupParam()also saves the system vision tool information.LoadJobFileParam()also reloads the JobFile vision tool information.
Build-time name check
- Parameter names after
JF.·SS.·MS.are checked at build time. An unknown name is an error; a case-only mismatch shows the correct name as a hint. RD.names are not checked at build time. Write them exactly.- A name passed as a literal string to
SetParamValue·GetParamValue("JF.PrintSpeed") is also checked at build time.
Cautions
JF.values are those of the JobFile currently open. Switching the JobFile switches to that JobFile's values.- On a parameter screen, a value outside the value range is shown in red and is not saved. Keep values written by scripts inside the range as well.
Related
- JobFile Manager · JobFile Setup · System Setup · Master Setup · Param Setup — screens that define parameters and edit their values
- SYS — System Functions — all parameter functions
- Global variables