Parses the given code scriptlet, adding declarations into the namespace and evaluating code as appropriate.

HRESULT ParseScriptText(
    LPCOLESTR pstrCode,              // address of scriptlet text
    LPCOLESTR pstrItemName,          // address of item name
    IUnknown *punkContext,           // address of debugging context
    LPCOLESTR pstrDelimiter,         // address of end-of-scriptlet delimiter
    DWORD_PTR dwSourceContextCookie, // application-defined value for debugging
    ULONG ulStartingLineNumber,      // starting line of the script
    DWORD dwFlags,                   // scriptlet flags
    VARIANT *pvarResult,             // address of buffer for results
    EXCEPINFO *pexcepinfo            // address of buffer for error data



[in] Address of the scriptlet text to evaluate. The interpretation of this string depends on the scripting language.


[in] Address of the item name that gives the context in which the scriptlet is to be evaluated. If this parameter is NULL, the code is evaluated in the scripting engine's global context.


[in] Address of the context object. This object is reserved for use in a debugging environment, where such a context may be provided by the debugger to represent an active run-time context. If this parameter is NULL, the engine uses pstrItemName to identify the context.


[in] Address of the end-of-scriptlet delimiter. When pstrCode is parsed from a stream of text, the host typically uses a delimiter, such as two single quotation marks (''), to detect the end of the scriptlet. This parameter specifies the delimiter that the host used, allowing the scripting engine to provide some conditional primitive preprocessing (for example, replacing a single quotation mark ['] with two single quotation marks for use as a delimiter). Exactly how (and if) the scripting engine makes use of this information depends on the scripting engine. Set this parameter to NULL if the host did not use a delimiter to mark the end of the scriptlet.


[in] Application-defined value that is used for debugging purposes.


[in] Zero-based value that specifies which line the parsing will begin at.


[in] Flags associated with the scriptlet. Can be a combination of these values:

Value Meaning


If the distinction between a computational expression and a statement is important but syntactically ambiguous in the script language, this flag specifies that the scriptlet is to be interpreted as an expression, rather than as a statement or list of statements. By default, statements are assumed unless the correct choice can be determined from the syntax of the scriptlet text.


Indicates that the code added during this call should be saved if the scripting engine is saved (for example, through a call to IPersist*::Save), or if the scripting engine is reset by way of a transition back to the initialized state.


Indicates that the script text should be visible (and, therefore, callable by name) as a global method in the name space of the script.


[out] Address of a buffer that receives the results of scriptlet processing, or NULL if the caller expects no result (that is, the SCRIPTTEXT_ISEXPRESSION value is not set).


[out] Address of a structure that receives exception information. This structure is filled if IActiveScriptParse::ParseScriptText returns DISP_E_EXCEPTION.

Expand imageReturn Value

Expand imageRemarks

Expand imageSee Also