A variable is an area of the computer’s memory that you can use to store information temporarily while your publication is running. Variables can contain text, numbers, names, addresses, dates or just about anything else. The contents of variables can be used in calculations, inserted into text, read from files, written to files, etc.
Many objects, such as Check Boxes, Radio Buttons and Text Entry Fields, use variables to store information about their status or contents. You can use these variables, and others you create, within Action parameters in addition to or in place of literal text. For example, you might require readers to enter their name at the start of a publication. A Text Entry Field created for this purpose records the name into a variable. Later, that variable could be used to document a test score or to personalize the publication by adding the name to various screens.
Each variable used within a publication should be given a unique descriptive name. Like a pet dog, variables can be given almost any name. When used in VisualNEO for Windows, however, variable names should always be surrounded by brackets ([ ]). This is how VisualNEO for Windows knows that you’re talking about a variable named [Spot] and not the word “Spot”. Some examples of valid variable names are:
[Answer] [Name] [Price] [Score] [X] [Y]
Referencing a variable within Action parameters is simple: just insert the variable’s name into the text - remembering to enclose it in brackets, of course. For example:
AlertBox "Greetings" "Hello [Name]. Welcome to my publication."
Some advanced Actions use variables to pass information back to you. In the example below, the FileRead Action extracts a line of information from a file and places it into a variable called [Data]:
FileRead "Sample.txt" "1" "[Data]"
Variables may be inserted anyplace within your publication where text is required: object captions, Action parameters, file names, etc. For example, a publication that required readers to enter their name might also include a Push Button with the following caption:
[Name], please press this button to continue.
When viewing the publication, a reader named Sally would see: