Think of something that you wish Authorware could do but it doesn't?  Let the our good friends at Macromedia know via the wishlist.

Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed.

Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list.

Back

1086 - What does "\"" mean?

by - Joe Ganci


More on Backslashes

I am taking your Authorware scripting course.In the following code, could you please explain the use of the back slashes and quotation marks ("\",\"")?

comment := "\"" ^ FileLocation ^ FileName ^ "\",\"" ^ CurrentPageNum@linkframework ^ "\",\" " ^ IconTitle(CurrentPageID@link framework) ^ "\",\"" ^file date ^ "\",,\"" ^ debugger ^ "\",\"" ^ Date ^ "\",\"" ^ Time ^  "\"," ^debug severity ^ ",\"" ^ debug design ^ "\",,,,\"" ^ EntryText ^ "\""

At the beginning of the book is a section called The Power of the Backslash. Make sure you read that carefully first of all. In the example you're citing, we are creating a string which we are storing in the variable called comment. The string will be a comma-delimited set of data items. Because many of the data items need to be stored with quotation marks around them, the \" becomes a regular quotation mark in the final string. So the final string may look like this:

"C:\Files\Examples\debug.a6p","1"," 1010","25-02-03 01:20:40",,"Joe","4/17/2003 ","10:23 AM",2,"Enhanced",,,,"This is the bug report."

Notice where the commas are. I'm going to separate the fields where the commas are here:

"C:\Files\Examples\debug.a6p","1",
" 1010",
"25-02-03 01:20:40",
,
"Joe",
"4/17/2003",
"10:23 AM",
2,
"Enhanced",
,
,
,
"This is the bug report."
 
What the example does is to concatenate each element together, putting commas in between each element:

comment := "\"" ^ FileLocation ^ FileName ^ "\",\"" ^ CurrentPageNum@link framework ^ "\",\" " ^ IconTitle(CurrentPageID@link framework) ^ "\",\"" ^ file date ^ "\",,\"" ^ debugger ^ "\",\"" ^ Date ^ "\",\"" ^ Time ^  "\"," ^ debug severity ^ ",\"" ^ debug design ^ "\",,,,\"" ^ EntryText ^ "\""

So the first thing you see in the string is a quotation mark stored (which in our data comes immediately before the C:\. You can see that each \" becomes a " in the data items you see above. We use this approach because you cannot use:

"""

The second quote would be considered the end of the string and the third would cause an error. By placing a backslash before the second quotation, we are telling Authorware: "Don't treat the quotation mark following as an end-of-string marker. Instead, take it as a character to store. "

There are 0 reviews
Add your review
Back