Accessibility

Table of Contents

Leveraging the user-defined variables feature in RoboHelp 7

Creating user-defined variables

You can create user-defined variables using any of these three methods:

  • Using the User Defined Variables pod
  • Creating user-defined variables on the fly.
  • Creating user-defined variables using the keyboard shortcut: Control + F9.

Next, you'll take a look at each of these methods, and the pros and cons to using each.

Creating user-defined variable through the User Defined Variables pod

The advantage of using the dedicated User Defined Variable pod to create and manage user-defined variables is that you get an instant overview of all the user-defined variables used in the project. Since the User Defined Variable pod lists all variables, you are less likely to create duplicate variables or set up variables names that conflict with those that already exist.

Once you have planned your approach, you can use the User Defined Variables pod to create all the variables that you'll need before you start using them in the project.

To create a user-defined variable through the User Defined Variables pod:

  1. Open the User Defined Variable pod (from the View menu select Pods, User Defined Variables option).
  2. All the variables available in the project are listed in the pod.
  3. Right-click the User Defined Variables pod to display the shortcut menu.
  4. Select the New Variable... option from the menu (see Figure 1).

    Right-click to access the shortcut menu, then select New Variable

    Figure 1. Right-click to access the shortcut menu, then select New Variable

    Note: You can also use the Create New Variable button on the Pod menu or just double-click on any empty row in the pod.

  5. The New Variable window is displayed with fields to enter the Variable Name and value (see Figure 2).

    The New Variable window with Variable Name and value fields

    Figure 2. The New Variable window with Variable Name and value fields

  6. Type the Variable Name (i.e. Company_Name).
  7. Type the Default Variable Value (in the example, you use Honey Solutions). The variable value is the term that will be used to replace the Company_Name when any single source output is generated unless you modify the value on the single-source layout. See the section of this tutorial on Modifying user-defined variable values for different single-source layouts for more details.
  8. Click OK.
  9. The new variable is added to the User Defined Variables pod (see Figure 3).

    Note: Variable names can contain only alphanumeric characters, "_" or "-" and cannot exceed 255 characters.

    The new variable name appears in the User Defined Variables pod

    Figure 3.The new variable name appears in the User Defined Variables pod

    Note: RoboHelp 7 allows you to rename a variable. Just double-click on the variable name (in the User Defined Variables pod) to display the Variable Properties window and modify the variable name directly. Just note that this process may take a little time if you have used the variable in many parts of the project.

Creating user-defined variables on the fly

In Robohelp 7, there is a really easy way to create user-defined variables on the fly using the shortcut menu. This is the quickest way to define a variable, particularly if the User Defined Variables pod is not in view.

  1. Select the location within the topic where you want to insert the variable.
  2. Type the text that you wish to use for the variable value (note that you can also select existing text within the topic).
  3. Select the text that you wish to use for the variable value.
  4. Right-click on the text to display the shortcut menu
  5. Select the Add to – User Defined Variable option (see Figure 4)

    Select the Add to – User Defined Variable option

    Figure 4. Select the Add to – User Defined Variable option

  6. The New Variable window is displayed with the Variable Name field already completed (see Figure 5)

    The New Variable window is displayed.
    Figure 5. The New Variable window is displayed.
  7. Enter the name that you wish to use for the variable, for example Company_Name.

    Note: Variable names can contain only alphanumeric characters, "_" or "-" and cannot exceed 255 characters.

  8. Click OK.
  9. The new variable is inserted into the topic and added to the User Defined Variables pod.

Creating user-defined variables using the keyboard shortcut: Control + F9

A new user-defined variable can be created and inserted directly in a topic on the fly using the keyboard shortcut (Control + F9). Here are the steps:

  1. Select the location within the topic where you want to insert the variable.
  2. Press the shortcut keys Control + F9.
  3. A pair of braces is inserted and displayed in the topic. The braces are highlighted with a gray background.
  4. Type the variable name inside the braces as shown in the following example:

    {Product_Name}
    
  5. Enter the variable value by double-clicking on the variable name. This displays the New Variable window.
  6. If you do not enter a variable value at this stage, the variable is not added to the User Defined Variable folder in the Project tab and the following message is displayed:

    ERROR: Variable (Product_Name) is not defined