
MediaScript Objects and Methods 153
•
•
•
•
Text Response Object
The TextResponse objects allow users to create response objects that take strings and save
text files (“plain text”, “html”, or “xml”).
TextResponse Object Properties
There are no properties for this object.
TextResponse Object Methods
The TextResponse Object implements the following methods:
•
TextResponse()
•
append()
•
getText()
•
getTextType()
•
getType()
•
setText()
•
setTextType()
TextResponse()
The TextResponse object needs to be constructed using the new TextResponse()
constructor.
Syntax
var strObject = TextResponse(
<textType>
);
Parameters
textType - specifies the type of text using one of the following predefined values:
•
TextResponse.TypePlain to save text as a plain text file with extension .txt.
•
TextResponse.TypeHtml to save text as an HTML file with extension .html.
•
TextResponse.TypeXml to save text as an XML file with extension .xml.
Example
#include "sys:/TextResponse.ms"
function main() {
var strObject = new TextResponse(TextResponse.TypePlain);
strObject.setText("FOO FOR YOU");
strObject.append("\nAND FOO FOR ME");
resp.setObject(strObject, RespType.Streamed);
}