Cicode Programming Reference > Cicode Function Categories > Window Functions Introduction > WinFile

WinFile

Writes the graphics image of the active window to a file. The file is saved in the CitectSCADA compressed .bmp format.

Notes:

Syntax

WinFile(sFile [, xScale] [, yScale] [, bSwapBlackWhite] [, sMap] )

sFile:

The name of the file to be created.

xScale:

The x scaling factor for the item being printed. This argument is optional, as a default setting of 1 is used to maintain the horizontal scaling of the image. The outcome is proportional to 1; for example, 0.5 halves the width of the image .

yScale:

The y scaling factor for the item being printed. This argument is optional, as a default setting of 1 is used to maintain the current vertical scaling of the image. The outcome is proportional to 1; for example, 0.5 halves the height of the image.

bSwapBlackWhite:

Swaps the colors black and white for the purpose of printing pages with a lot of black content. Use the default value of 1 to swap black and white (optional).

sMap:

The file name or path of a text based map file used to specify colors to swap when printing. By default CitectSCADAwill look in the bin directory for the map file. The format for the map file is:

RRR GGG BBB RRR GGG BBB [HHH] [SSS] [LLL]//
RRR GGG BBB RRR GGG BBB [HHH] [SSS] [LLL]//

Where:

RRRis a decimal red intensity value between 000 and 255.

GGGis a decimal green intensity value between 000 to 255.

BBBis a decimal blue intensity value between 000 to 255.

HHH, SSS and LLL are optional tolerance values to enable swapping a range of colors. Default values are shown below.

HHH is a decimal value representing the Hue tolerance. Valid range is 0 to 360. Default = 0.

SSS is a decimal value representing the Saturation tolerance. Valid range is 0 to 255. Default = 2 * Hue tolerance.

LLL is a decimal value representing the Luminance tolerance. Valid range is 0 to 255. Default = 2 * Hue tolerance.

Leading zeros are not required, however they aid readability.

The first three RGB values specify the FROM color, and the second three RGB values specify the TO color. The tolerance values are applied to the FROM color when replacing individual pixels in the image.

Comments may be placed at the end of each line, or on individual lines, and needs to be proceeded with // or !.

Example map file to swap the CSV_Include project:

043 043 255 155 205 255 025 000 025 
//Change dark blue to light blue using Hue and Luminance tolerance of 25. (Converts the CSV title bar)
000 000 000 255 255 255 //Swap black to white with no tolerance

Note:If swap color ranges overlap, the behavior is undefined (i.e. a color that falls in both ranges may end up as either color)

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

WinPrint

Example

WinFile("DUMP");
/* Writes the active window to a file named DUMP in the current directory. */

See Also

Window Functions