11-13-2007 09:05 AM
11-14-2007 09:14 AM
richjoh -
We would need more information. I assume you are talking about the Message Popup step. If I enter the expression "Your message here \r\n abc" or "Your message here \n abc" in an expression, the MessagePopup step displays a multiline message, so I would expect that the step type should display the text properly. You might have to post an example for us to look at and let us know what version you are using.
11-14-2007 09:52 AM
richjoh -
I realized that you might be assuming that if the file text that you read in to a TestStand string property contains the two characters '\' and 'n' you were hoping that TestStand would convert the two characters to a '\n'. TestStand requires control characters to be escaped(\\, \n, \r etc) in an expression string literal because without them TestStand might not be able to parse the overall expression properly. TestStand automatically unescapes control characters in string literals within expressions. Now, a string property value can contain escape characters and you can edit the value in the variables view without have to escape control characters.
If you want to convert the "\n" text to a control character in the string property you can just use an expression function to do this. For example
"Here is my text from my file:\n" + SearchAndReplace(Locals.StringProperty, "\\\n", "\n")
Hope this helps...
11-19-2007 12:40 PM
11-19-2007 01:55 PM
When you create a static string (such as defining it in the message popup) TestStand expects that there might be special characters you might want to use, so you can use a "\" character to define them. However, when you are using a property object string, TestStand does not expect special characters. It expects the exact string that you type in is the string that you want. Therefore, if you type in a "\" in the variables pane, TestStand interprets it as a literal "\" and not an escape character.
An Example:
Lets say we define a static (literal) string "Hello\nWorld". In memory, TestStand is going to represent it as the character string "Hello\nWorld". Litterally what you typed.
If we define a property object string "Hello\nWorld", in memory TestStand is going to represent it as the character string "Hello\\nworld". TestStand added the second backslash to preserve the characters that you typed in. There is a workaround for this is what Scott showed you above; you can search and replace all of the "\\" you find with just single "\" characters.
11-19-2007 03:52 PM
"Hello"
+ chr(13) + "world"01-06-2014 02:57 PM
I know this is an old thread, but I found one solution in an NI KB document:
http://digital.ni.com/public.nsf/allkb/78D9AC8EA0C9E978862576CC007825AC
Here is the solution that worked for me (referring to richjoh's original post above). Note that I am using a Locals string variable in my application:
Locals.mess_no_1 = "" hit OK when ready \n If not ready hit cancel"" >> Note double quotes in string
In the message popup, use the Evaluate command as follows:
Evaluate( Locals.mess_no_1 )
That is the only way I have found to use the \n sequences in the message popup from a variable.