Modifying/Customizing TestStand Strings
Overview
Many of the messages that TestStand displays within the sequence editor, operator interface, step property views, and assorted pop-ups and menus are stored within special text files rather than hard-coded into the environment. These files, commonly referred to as .ini files or resource string files, all follow an identical template and can easily be read or edited via any text editing tool on your system.
Table of Contents
Introduction to Using Resource String Files
TestStand loads all .ini files into memory at engine start-up, such as whenever you launch the sequence editor, or instantiate a new Engine object from within your Application Development Environment (ADE), such as LabVIEW. Once these files are loaded in memory, any changes made to them will not be detected by TestStand until the engine is shutdown and restarted.Values in the .ini files are meant to be accessed by TestStand using the GetResourceString method of the Engine class, or the wrapper function available for any expression to be evaluated called ResStr(). The GetResourceString method takes a string category and a tag name as arguments. It searches for the string in all resource string files located in a predefined set of directories.
The directory search order is as follows:
- <TestStand>\Components\User\Language\<current language>- <TestStand>\Components\User\Language- <TestStand>\Components\NI\Language\<current language>- <TestStand>\Components\NI\Language\English- <TestStand>\Components\NI\LanguageTestStand ships with resource string files for both English and Japanese display characters and it is possible to also create/modify string files for other languages or per-language behavior. To change the current language setting, select Configure»Station Options and selecet the Localization tab. TestStand installs the default resource string files in the
<TestStand>\Components\NI\Language directory tree. If you want to customize a resource string file for a different language, you must copy an existing language file from the NI directory, place it in the User directory in a language subdirectory, and modify it. If you want to create a resource string file that applies to all languages, place the resource file in the base <TestStand>\Components\User\Language directory.
Creating New Files and Tags
The most common reason to modify a resource string file is to include categories and tags for your custom components. When adding your new strings to an existing or brand new file, make sure that the category names are unique so that they do not conflict with any names that TestStand uses. If you choose the same category name and tag as a preexisting component your new string will be overwritten by the TestStand default, or your new string will overwrite the TestStand default, depending on where it falls in relation to the original string in the directory search order. In short, whichever version of the string is loaded last will be the version of the string that you see after the program starts.
When editing a resource string file there is a simple pattern to follow. Each string resource file must have the .ini file extension and should be saved as plain text.
The format of a string resource file is as follows:
[category1]
tag1 = "string value 1"
tag2 = "string value 2"
[category2]
tag1 = "string value 1"
tag2 = "string value 2"
The string assigned to a given tag can contain some basic C-style formatting by making use of special characters like "\n". Refer to the TestStand User Manual for more information about Creating String Resource Files and other special characters available to you.
A function call to retrieve this string may look like:
ResStr ("catagory1", "tag1")
Common Resource String Files
If you wish to make modifications to any resource string file, it is always encouraged that you make a copy of the desired file and place it in a parallel directory based off of
<TestStand>\Components\User. When TestStand searches for a file it will always look first in the User directory and then in the NI directory. If files are copied before editing, you can always return to the default version of the file. Following are examples of useful resource string files available on your system:
- <TestStand>\Components\NI\Language\English\OperatorInterfaceStrings.ini- <TestStand>\Components\NI\Language\English\TestSandStrings.ini- <TestStand>\Components\NI\Language\English\Units.ini- <TestStand>\Components\NI\Language\English\ErrorStrings.ini- <TestStand>\Components\User\Language\English\CustomStrings.ini**** A special case is when you wish to edit the TestStandStrings.ini file. This file is one of the largest resource string lists loaded by the TestStand Engine and provides all the options and labels for the sequence editor and its basic panels and displays. Since most users who wish to edit this file simply want to change one or two items, or add their custom strings for new components, browsing the large text file to find your changes was considered to be inconvenient. Instead, users are strongly encouraged to use the following file:
<TestStand>\Components\User\Language\English\CustomStrings.iniThis resource string file is empty by default and is the ideal location to add any user customizations needed for your personalized development system. Since it is always loaded after the TestStandStrings.ini file, it can be used as an addendum for new information, or as an override for a preexisting tag. For example, if you wish to override the resource string for:
[LOGIN_DLG]
DLG_TITLE = "Login"
You could directly edit TestStandStrings.ini or a copy of it made to the <TestStand>\Components\User directory, but the easier approach would be to simply add these two lines of code to the CustomStrings.ini file. You could change the title of the dialog box to be something like:
[LOGIN_DLG]
DLG_TITLE = "ACME Corp. User Login"
A second and important benefit to using the CustomStrings.ini file is that it is an excellent way of planning for future releases of TestStand. Modifying the TestStandStrings.ini file to have custom behavior will create overhead should you upgrade TestStand. The TestStandStrings.ini file will be overwritten anytime you upgrade to a newer version so that the menus and strings for new components are added, however the CustomStrings.ini file is strictly for user customizations and so is left intact during any updates or patches.
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
