![]() |
|
getvar |
Longname: | get var iable | ![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
Released: | not available | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Created: | not available | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Last modified: | 6.78a |
Summary |
The getvar macro allows you to extract system information from 3B2 about the user's setup. This information can be utilised in many stituations for example; assessing the state of the current document, values of items currently in format, or results of conditional formatting tests. |
Example extract |
The getvar code for the 'current text stream name' is 11520. The syntax shown below gets the current text stream name and places it in a variable called ^name:
|
Syntax
|
data type:n |
The first digit of a getvar code defines the type of data that will be retrieved by getvar. The currently defined types are: |
data type:n |
|
data type:n |
|
data type:n |
|
data type:n |
|
how many:n |
The second digit of a getvar code tells 3B2 how many values to get. The first value is that of the code listed in the macro. The second and subsequent values are those of the next consecutively numbered items in the list of getvar codes.
|
data group:n |
3B2 getvar codes are organised in five groups, each of which can contain up to 100 items numbered from 0 to 99. With data types 0..2 the third digit of a getvar code simply tells 3B2 which group to look at. |
item number:n |
The last 2 digits of a getvar code specify a precise item number that identifies the data retrieved by getvar. Item numbers are allocated by Advent arbitrarily, but related items are kept together so that they can be retrieved with a single getvar command (see how many). Not all item numbers are used - gaps in the numbering are left for future expansion. |
string number:n |
A three digit number representing a numbered string in one of 3B2's strings files or a string defined with defstr or addstr. |
variable:s |
The name(s) of one or more variable(s) which you wish to store this information in. The variable names which store the requested values have to appear inside double quotes, but do not have the leading ^ symbol. |
Macros, scripts and show strings often require information about a user's setup and document settings. This can include items such as the size of the screen, colour settings and zoom level, current font selections, etc. |
In most scripts using wdb is far simpler, although using getvar gives your script access to a number of items for which dialogue boxes do not exist, such as a user's command-line parameters, screen pixel width and height, mouse position etc. It is also not sensitive to the order in which dialogue boxes are constructed. |
The getvar code, a sequence of five digits used by 3B2 to identify setup and document-specific items (system variables). Each getvar code consists of a sequence of digits which represent four specific components: |
|
|
You should, however, be able to use the list of getvar codes without being too concerned about what each of the digits stands for. A full list of 3B2 getvar codes can be accessed through any of the show strings dialogue boxes, or with the macro wmn 800 pre 3B2 V7 and wmnx 800 post 3B2 V7. A full list is also available in the System Variables_en section. |
Example |
The getvar codes for the size of the current text stream and the cursor position in the current text stream are 21521 and 21522 respectively. The macro shown below gets these variables and places them in two variables called ^s and ^p.
|
![]() |
It is worth remembering that show strings can be used to display the first 79 characters of a numbered string, e.g. <?show $31005v> would display the first 79 characters of string no.5 ('{manuals}clip') on the page. This feature can be quite useful if you are using defstr or addstr to define a string and want to check on how the string is being written. |
Example |
You can also use getvar to insert variable text in your text stream. The diagnstc.3d file supplied with Arbortext APP is a good example of a text composed almost entirely of show strings using getvar codes. The example below inserts the current filename into your text stream:
|
Document created on 08-Feb-2003 (revision 1)