Dystlab software has its own scripting engine (Scripter) that supports Pascal and Basic programming languages. Scripter can be used to develop applications, draw frames in reports, graphical visualizations, and more.


Report library

function Report.AddNote(S: string): Integer;

Adds the string S to the Notes list and returns the number of this item.

Example: i := Report.AddNote('J. Smith');

procedure Report.AddNotePair(Name, Value: string);

Adds a “Name=Value” pair element to the Notes list.

Example: Report.AddNotePair('Author: ', 'J. Smith');

property Report.BrushColor: Integer;

Specifies the fill color for the following shapes. The color must be an integer. The property also returns the current fill color.

Example: Report.BrushColor := clGreen;

procedure Report.ClearNotes;

Deletes all items in the Notes list.

Example: Report.ClearNotes;

procedure Report.DrawArc(x1,y1,x2,y2,x3,y3,x4,y4: Double);

Draws an arc inscribed in a rectangle with coordinates (x1,y1)-(x2,y2), (x3,y3)-(x4,y4), in mm.

Example: Report.DrawArc(10,0,0,10,-10,0,0,-10);

procedure Report.DrawCircle(x,y,R: Double);

Draws a circle of radius R centered at the point (x,y), in mm.

Example: Report.DrawCircle(100,100,60.5);

procedure Report.DrawEllipse(x1,y1,x2,y2: Double);

Draws an ellipse inscribed in a rectangle with diagonal coordinates (x1,y1)-(x2,y2), in mm.

Example: Report.DrawEllipse(100,100,150,200);

procedure Report.DrawFillRectangle(x1,y1,x2,y2: Double);

Draws a filled rectangle at the coordinates of the diagonal line (x1,y1)-(x2,y2), in mm.

Example: Report.DrawFillRectangle(0,0,100,200);

procedure Report.DrawFitPagePicture(Path: string);

Draws the image specified in an external file. The image is stretched to fit the sheet size. The file path can be relative or absolute.

Example: Report.DrawFitPagePicture('C:\image1.png');

procedure Report.DrawFixedHeightPicture(x,y,h: Double; Path: string);

Draws the image specified in an external file. The (x,y) coordinates refer to the upper left corner of the image. The height of the image is set in the “h” parameter, and the width is automatically adjusted by the aspect ratio. The file path can be relative or absolute.

Example: Report.DrawFixedHeightPicture(50,50,250,'C:\image1.png');

procedure Report.DrawFixedWidthPicture(x,y,w: Double; Path: string);

Draws the image specified in an external file. The (x,y) coordinates refer to the upper left corner of the image. The width of the image is set in the “w” parameter, and the height is automatically adjusted by the aspect ratio. The file path can be relative or absolute.

Example: Report.DrawFixedWidthPicture(50,50,250,'C:\image1.png');

procedure Report.DrawLine(x1,y1,x2,y2: Double);

Draws a line at the start (x1,y1) and end (x2,y2) coordinates, in mm.

Example: Report.DrawLine(0,0,25,25);

procedure Report.DrawPicture(x,y: Double; Path: string);

Draws the image specified in an external file. The (x,y) coordinates refer to the upper left corner of the image. The file path can be relative or absolute.

Example: Report.DrawPicture(50,50,'C:\image1.png');

procedure Report.DrawRectangle(x1,y1,x2,y2: Double);

Draws a rectangle outline at the coordinates of the diagonal line (x1,y1)-(x2,y2), in mm.

Example: Report.DrawRectangle(20,5,205,294);

procedure Report.DrawRotatedText(x,y,a: Double; S: string);

Prints the text S at the upper left corner coordinates (x,y). Additionally, you can specify the angle of rotation of the text “a” in degrees, counterclockwise.

Example: Report.DrawRotatedText(100,100,90,'rotated text');

procedure Report.DrawText(x,y: Double; S: string);

Prints the text S at the coordinates of the upper left corner (x,y), in mm.

Examples:

Report.DrawText(10,10,'Author: J. Smith');

Report.DrawText(100,100,DateToStr(Now));

property Report.FontColor: Integer;

Specifies the font color for the following text commands or returns the current font color.

Example: Report.FontColor := clBlue;

property Report.FontName: string;

Specifies the font name for the following text commands or returns the current font name.

Example: Report.FontName := 'Times New Roman';

property Report.FontSize: Integer;

Indicates the size of the font for the following text commands or returns the current font size.

Example: Report.FontSize := 14;

function Report.GetNote(Index: Integer): string;

Returns the item in the Notes list by Index number.

Example: S := Report.GetNote(10); // S='my note'

function Report.GetNoteValue(Name: string): string;

Returns an item in the Notes list by the name Name.

Example: S := Report.GetNoteValue('city'); // S='New York'

procedure Report.InsertScriptEquation(Identifier: string);

Adds an automation object containing the Identifier script to the report. The Identifier can be a variable, function, or expression in Pascal. The object is added as LaTeX formula.

Example: Report.InsertScriptEquation(IntToStr(2+2));

procedure Report.InsertScriptMultilineText(Identifier: string);

Adds an automation object containing the Identifier script to the report. The Identifier can be a variable, function, or expression in Pascal. The object is added as a table without borders (multi-line text).

Example: Report.InsertScriptMultilineText(IntToStr(2+2));

procedure Report.InsertScriptText(Identifier: string);

Adds an automation object containing the Identifier script to the report. The Identifier can be a variable, function, or expression in Pascal. The object is added as plain text.

Example: Report.InsertScriptText(IntToStr(2+2));

property Report.Notes: TStringList;

Access the Notes list.

Example: S := Report.Notes[0];

property Report.PageCount: Integer;

Returns the number of pages in the report.

Example: ShowMessage(IntToStr(Report.PageCount));

property Report.PageHeight: Double;

Sets or returns the current page height, in mm.

Example: Report.PageHeight := 297; // 297 mm

property Report.PageNo: Integer;

Specifies the page number for the following commands. If you want to run the commands on all report pages, set 0.

Example: Report.PageNo := 1;

property Report.PageWidth: Double;

Sets or returns the current page width, in mm.

Example: Report.PageWidth := 210; // 210 mm

property Report.PenColor: Integer;

Sets the line color for the following shapes or returns the current color. The color must be an integer.

Example: Report.PenColor := clRed; // red lines

property Report.PenWidth: Integer;

Sets the line thickness for the following shapes or returns the current thickness.

Example: Report.PenWidth := 2; // 2-pixel lines

procedure Report.Update;

Initiates an automation session and updates the current report.

Example: if Finished then Report.Update;