In this tutorial we explain how to create, edit, and delete Adobe Captivate variables. One of the easiest tasks you’ll ever perform in Captivate is to create a new user variable. This is just as well, because if you intend to be creating complex interactivity in your e-learning, you’ll definitely be creating lots of variables!
Create a User Variable
- From the Project main menu, select the Variables option.
- When the Variables dialog opens, click the Add New button. (The screen below is from Captivate 7.1, but except for the extra Usage button, all versions since Captivate 5 are much the same.)
- Type the name of your user variable. I recommend you pause before moving on here because you cannot later change this name once you save it. Check out the recommendations here about variable naming conventions.
- Enter a default variable value (if applicable) and provide a Description of its purpose.
- When you are finally happy with the details, click the Save button.
Your newly-created variable will now be listed in the lower part of the Variables dialog. Variables are listed in alphabetical order, with only two exceptions. Captivate 7 users will find two new user variables called cpQuizInfoStudentID (used for Internal Server Reporting) and cpQuizInfoStudentName (used for capturing the student name variable from a learning management system). For some reason, Adobe has opted to have these variables always sort to the bottom of the list of variables.
Edit a User Variable
Once you’ve created a number of user variables from time to time you’ll need to change something. Since you cannot change the variable’s name, your editing options are limited to altering the default value, description text, or removing/deleting the variable altogether.
- Open the Variables dialog and select the variable you want to change. (The Update button is initially disabled until you make some detectable change to the variable properties.)
- You cannot edit the variable's name. Edit the Value or Description fields as needed and then click the Update button. (After making the change, the Update button again becomes inactive.)
By the way, this article is an excerpt from my: Infosemantics Guide to Adobe Captivate Advanced Actions e-book. Not only does this book offer more than 200 pages of essential information for Captivate developers, it also comes with the actual CPTX files I used for screenshots when writing the e-book. You can download and open these bonus files for Captivate versions 5, 6 and 7 to see exactly how the advanced actions and interactions I explain in the book are actually set up in a real project.
Remove (Delete) a User Variable
As you develop a project you may find that some of the variables you create become redundant and need to be removed (perhaps because you had to create a duplicate variable with a different name). It’s a good idea to take out the trash by deleting these unwanted variables because they can waste browser memory and slow down run-time performance.
The process is simple enough…but there are some important issues to be aware of:
- Open the Variables dialog and select the variable to be deleted.
- Click the Remove button.
- Now things get a little more complex. Please note the following caveats about removing variables:
- You can only remove user variables, not system variables.
- You can remove a variable referenced by a single action that assigns its value, but this will result in the action being reset to Continue.
- You can only remove user variables that are NOT currently being used to display values in screen objects such as text captions or shapes. Additionally, you cannot remove any variables currently referenced by Standard or Conditional Actions in your project file. If you try to remove one of these referenced variables, Captivate will show the following warning message.
Unfortunately, this warning message doesn’t give you any information about which specific slides or advanced actions use the variable and need to be modified before you can remove it. In a large project with many slides and actions, this can be like trying to find a needle in a digital haystack.
Want to trace variable usage? Upgrade to Captivate 7.0.1
The inability to trace where user variables were referenced in a project file was a huge weakness in Captivate functionality that was finally addressed with the Captivate 7.0.1 update patch released in mid November 2013. The Variables dialog now has a Usage button (similar to the one on the Advanced Actions dialog) that when clicked will show where the currently selected variable is referenced on any slide in the project, as well as which specific run-time event is used to execute the action involved.
This now makes it extremely easy to do any required project file housekeeping. If your variable is not used anywhere, you’ll just see a dialog simply saying "Item is not currently in use" and you can safely delet it.
However, there appears to be one caveat. Variables that are referenced in widgets don’t get taken into account by the Usage dialog. So if you have a lot of widgets or interactions (which are also widgets) in your project, you may need to check them manually before starting any round of mass deletions.