C# Class MsieJavaScriptEngine.ActiveScript.ActiveScriptSiteWrapper

Inheritance: IActiveScriptSite, IDisposable
ファイルを表示 Open project: klumsy/PowerShellJS Class Usage Examples

Public Methods

Method Description
ActiveScriptSiteWrapper ( IntPtr pActiveScript, IActiveScript activeScript ) : System

Constructs instance of ActiveScriptSiteWrapper

ActiveScriptSiteWrapper ( IntPtr pActiveScript, IActiveScript activeScript, string documentVersion ) : System

Constructs instance of ActiveScriptSiteWrapper

CallFunction ( string functionName ) : object

Calls a function

DeleteProperty ( string propertyName ) : void

Removes a global object property

Dispose ( ) : void

Destroys object

ExecuteScriptText ( string code, bool isExpression ) : object

Executes a script text

GetDocVersionString ( string &version ) : void

Retrieves a host-defined string that uniquely identifies the current document version. If the related document has changed outside the scope of Windows Script (as in the case of an HTML page being edited with Notepad), the scripting engine can save this along with its persisted state, forcing a recompile the next time the script is loaded.

GetItemInfo ( string name, ScriptInfoFlags returnMask, object &item, IntPtr &pTypeInfo ) : void

Allows the scripting engine to obtain information about an item added with the IActiveScript.AddNamedItem method

GetLcid ( int &lcid ) : void

Retrieves the locale identifier associated with the host's user interface. The scripting engine uses the identifier to ensure that error strings and other user-interface elements generated by the engine appear in the appropriate language.

GetProperty ( string propertyName ) : object

Gets a value of global object property

HasProperty ( string propertyName ) : bool

Сhecks for the existence of a global object property

OnEnterScript ( ) : void

Informs the host that the scripting engine has begun executing the script code

OnLeaveScript ( ) : void

Informs the host that the scripting engine has returned from executing script code

OnScriptError ( IActiveScriptError scriptError ) : void

Informs the host that an execution error occurred while the engine was running the script.

OnScriptTerminate ( object result, System.Runtime.InteropServices.ComTypes.EXCEPINFO exceptionInfo ) : void

Informs the host that the script has completed execution

OnStateChange ( ScriptState scriptState ) : void

Informs the host that the scripting engine has changed states

SetProperty ( string propertyName, object value ) : void

Sets a value to global object property

Protected Methods

Method Description
OnScriptError ( ActiveScriptException exception ) : void

Informs the host that an execution error occurred while the engine was running the script

Private Methods

Method Description
Dispose ( bool disposing ) : void

Destroys object

GetAndResetLastException ( ) : ActiveScriptException

Gets and resets a last exception. Returns null for none.

GetItem ( string name ) : object

Allows the scripting engine to obtain information about an item added with the IActiveScript.AddNamedItem method

GetTypeInfo ( string name ) : IntPtr

Allows the scripting engine to obtain information about an item added with the IActiveScript.AddNamedItem method. Gets the COM ITypeInfo

InitScriptDispatch ( ) : void

Initializes a script dispatch

ThrowError ( ) : void

Method Details

ActiveScriptSiteWrapper() public method

Constructs instance of ActiveScriptSiteWrapper
public ActiveScriptSiteWrapper ( IntPtr pActiveScript, IActiveScript activeScript ) : System
pActiveScript System.IntPtr Pointer to an instance of native JavaScript engine
activeScript IActiveScript Instance of native JavaScript engine
return System

ActiveScriptSiteWrapper() public method

Constructs instance of ActiveScriptSiteWrapper
public ActiveScriptSiteWrapper ( IntPtr pActiveScript, IActiveScript activeScript, string documentVersion ) : System
pActiveScript System.IntPtr Pointer to an instance of native JavaScript engine
activeScript IActiveScript Instance of native JavaScript engine
documentVersion string Host-defined document version string
return System

CallFunction() public method

Calls a function
public CallFunction ( string functionName ) : object
functionName string Function name
return object

DeleteProperty() public method

Removes a global object property
public DeleteProperty ( string propertyName ) : void
propertyName string Name of property
return void

Dispose() public method

Destroys object
public Dispose ( ) : void
return void

ExecuteScriptText() public method

Executes a script text
public ExecuteScriptText ( string code, bool isExpression ) : object
code string Script text
isExpression bool Flag that script text needs to run as an expression
return object

GetDocVersionString() public method

Retrieves a host-defined string that uniquely identifies the current document version. If the related document has changed outside the scope of Windows Script (as in the case of an HTML page being edited with Notepad), the scripting engine can save this along with its persisted state, forcing a recompile the next time the script is loaded.
public GetDocVersionString ( string &version ) : void
version string The host-defined document version string
return void

GetItemInfo() public method

Allows the scripting engine to obtain information about an item added with the IActiveScript.AddNamedItem method
public GetItemInfo ( string name, ScriptInfoFlags returnMask, object &item, IntPtr &pTypeInfo ) : void
name string The name associated with the item, as specified in the /// IActiveScript.AddNamedItem method
returnMask ScriptInfoFlags A bit mask specifying what information about the item should be /// returned. The scripting engine should request the minimum amount of information possible /// because some of the return parameters (for example, ITypeInfo) can take considerable /// time to load or generate
item object A variable that receives a pointer to the IUnknown interface associated /// with the given item. The scripting engine can use the IUnknown.QueryInterface method to /// obtain the IDispatch interface for the item. This parameter receives null if returnMask /// does not include the ScriptInfo.IUnknown value. Also, it receives null if there is no /// object associated with the item name; this mechanism is used to create a simple class when /// the named item was added with the ScriptItem.CodeOnly flag set in the /// IActiveScript.AddNamedItem method.
pTypeInfo System.IntPtr A variable that receives a pointer to the ITypeInfo interface /// associated with the item. This parameter receives null if returnMask does not include the /// ScriptInfo.ITypeInfo value, or if type information is not available for this item. If type /// information is not available, the object cannot source events, and name binding must be /// realized with the IDispatch.GetIDsOfNames method. Note that the ITypeInfo interface /// retrieved describes the item's coclass (TKIND_COCLASS) because the object may support /// multiple interfaces and event interfaces. If the item supports the IProvideMultipleTypeInfo /// interface, the ITypeInfo interface retrieved is the same as the index zero ITypeInfo that /// would be obtained using the IProvideMultipleTypeInfo.GetInfoOfIndex method.
return void

GetLcid() public method

Retrieves the locale identifier associated with the host's user interface. The scripting engine uses the identifier to ensure that error strings and other user-interface elements generated by the engine appear in the appropriate language.
public GetLcid ( int &lcid ) : void
lcid int A variable that receives the locale identifier for user-interface /// elements displayed by the scripting engine
return void

GetProperty() public method

Gets a value of global object property
public GetProperty ( string propertyName ) : object
propertyName string Name of property
return object

HasProperty() public method

Сhecks for the existence of a global object property
public HasProperty ( string propertyName ) : bool
propertyName string Name of property
return bool

OnEnterScript() public method

Informs the host that the scripting engine has begun executing the script code
public OnEnterScript ( ) : void
return void

OnLeaveScript() public method

Informs the host that the scripting engine has returned from executing script code
public OnLeaveScript ( ) : void
return void

OnScriptError() protected method

Informs the host that an execution error occurred while the engine was running the script
protected OnScriptError ( ActiveScriptException exception ) : void
exception ActiveScriptException The exception
return void

OnScriptError() public method

Informs the host that an execution error occurred while the engine was running the script.
public OnScriptError ( IActiveScriptError scriptError ) : void
scriptError IActiveScriptError A host can use this interface to obtain information about the /// execution error
return void

OnScriptTerminate() public method

Informs the host that the script has completed execution
public OnScriptTerminate ( object result, System.Runtime.InteropServices.ComTypes.EXCEPINFO exceptionInfo ) : void
result object A variable that contains the script result, or null if the script /// produced no result
exceptionInfo System.Runtime.InteropServices.ComTypes.EXCEPINFO Contains exception information generated when the script /// terminated, or null if no exception was generated
return void

OnStateChange() public method

Informs the host that the scripting engine has changed states
public OnStateChange ( ScriptState scriptState ) : void
scriptState ScriptState Indicates the new script state
return void

SetProperty() public method

Sets a value to global object property
public SetProperty ( string propertyName, object value ) : void
propertyName string Name of property
value object Value of property
return void