$setproperty

Changes the settings of certain device properties of the registry variables file.

Syntax

$setproperty(section, property, newsetting)

Parameters

section

A character string or an expression that evaluates to a character string to indicate the group of properties or registry values that should be changed.

property

A character string or an expression that evaluates to a character string to name the property or register that should be changed.

newsetting

A character string or an expression that evaluates to a character string containing the new value for the property or register value.

Return Value

A character string containing "1" ($True) if the arguments to the function were valid and newsetting was applied. Otherwise, it returns "0" ($False).

Comments

If more than one $setproperty is used during the generation of a report, then only the last $setproperty is in effect when the report is printed.

Care should be taken when changing the setting of registry values, as improper manipulation can result in program or system failure.

The following are possible values for section, property and their corresponding newsetting:

"DESKTOP"

Changes properties of Zim desktop.

property and newsetting

The only possible value for a desktop property is "ScreenUnits" which accepts the following newsetting:

0 = screen units are pixels;
1 = screen units are twips;
2 = screen units are points;
3 = screen units are logical inches;

 

"PRINTER"

Sets printer properties of the default printer.

property and newsetting

 

Possible values for a printer property and corresponding newsetting are:

"Color" or "Colour" = 1, Monochrome; 2, color;
"Copies" = number of copies;
"DisplayPrintDialog" = 0 or 1, prints the dialog; 2, doesn't print it;
"Duplex" = 1, Simplex; 2, Vertical; 3, Horizontal;
"FontName" = a valid font name;
"FontSize" = a valid font size;
"MonospacedFont" = 0 or 1, uses mono-spaced fonts; 2, doesn't use it;
"Orientation" = 1 for Portrait and 2 for Landscape;
"PaperBin" = a number indicating the paper bin (see the printer manual);
"PaperLength" = a number to indicate the paper length (see the printer manual);
"PaperSize" = a number to indicate the paper size (see the printer manual);
"PaperWidth" = a number to indicate the paper width (see the printer manual);
"PrintQuality" = a number indicating the printing quality (see the printer manual);
"Reset" = any value resets to the default values (the value is ignored);
"Scale" = a number indicating the scale to be used for printing;
"TrueTypeOption" = 1, bitmap; 2, download; 3, substitute; 4, outline;
"YResolution" = a number indicating the Y resolution.

 

"SESSION"

Sets properties for the current session of Zim.

property and newsetting

 

Possible values for the Zim session property and the corresponding newsetting are the ones described in the Zim configuration options for the current database. See Zim Database Configuration File (zimconfig.zim) for further details.

 

"REG:[sub-section]" or "INI:[sub-section]"

Sets any properties of this user-defined sub-section.

property and newsetting

 

property and newsetting can have any values because they are user-defined.

"SESSION":

"REG:[ODBC]"

To programmatically create an ODBC data source connection.

property and newsetting

 

Possible values for the ODBC Driver data source property and the corresponding newsetting are:

The data source name = must be $getproperty("REG:[ODBC]", "VERSION");
"DBQ" = the database name to connect to;
"Driver" = must be $getproperty("REG:[ODBC]", "DRIVER");
"DSN NAME" = the name of the data source;
"Host" = the address of the machine running Zim Server;
"PWD" = the password of the connecting user;
"Server" = the port number that Zim Server is listening to;
"UID" = user name identification;
"WorkPath" = work path of the current session.

For more information, see Configuring a Data Source.

If running the Zim executable, the section "REG:[...]" sets the registry values in the machine where Zim Server is running because Zim only runs in the same machine as Zim Server runs.

If running the Zim Thin executable, the section "REG:[...]" sets the registry values in the machine where Zim Thin is running.

In order to set registry values in the machine where Zim Server is running when running Zim Thin, you must use the section "SERVREG:[...]" which has the same meaning and syntax as "REG:[...]".

 

Examples

let vSet = $setproperty ("printer", "fontsize", "12")

Sets the font size of the default printer to 12.

let vSet = $setproperty ("REG:[MYSET]", "My Setting", "I like this one.")

Sets "I like this one." in the property "My Setting" belonging to the sub-section "MYSET". This kind of setting is useful for applications to keep track of values used in the Zim application.

let vSet = $setproperty ("SESSION", "Parameter Size", "2000")

Sets the database configuration option "Parameter Size" to 2000.

 

Related Topics