These pages were the activescripting newsgroup FAQ. They were collected by Mark Baker, and originally were hosted on his site.
His website is down since several years, I tried to contact him but couldn't. I hope everything is fine for you Mark.
This FAQ has been invaluable resources when working on FScript (a FARR plugin ). It's a little bit old technology but it can do great stuff still.
I couldn't get back some of the pages from google cache or from web archive. If someone has them, I'll be happy to add them.
Introduction
Getting Started
Hosting – General
In the .NET World
Hosting – Running Scripts
-
How do I execute a
script in a given language?
-
How can I call a
specific function or subroutine within my script?
-
How can I determine
the correct scripting engine to create from a script’s text?
-
What is the easiest
way to re-execute a script?
-
When I’m done with
the scripting engine, how should I release the engine?
-
How do I trap
runtime errors in my script?
-
Why does setting the
boolean variable "callOnScriptErrorWhenContinuing" in
IActiveScriptSiteDebug::OnScriptErrorDebug() not call
IActiveScriptSite::OnScriptError?
-
How do I signal an
error from my host that can be trapped by my script?
-
How do I handle
script errors without using the script debugger?
-
How do I disable
the script debugger for my scripts?
-
How do I trap
syntax errors in a script within my host?
-
If the engine
reports an error in a script, how do I know where the error is located?
-
If the engine
reports an error in a script, how do I know what kind of error it found?
-
How do I know when
a script is finished executing?
-
If I call methods
on the scripting engine from a thread other than the one I used to create the
engine, I get the HRESULT E_UNEXPECTED. What do I need to do to be able to call
the engine from any thread (or multiple threads)?
-
In the
IActiveScriptParse->ParseScriptText interface/method, what is the definition
of the "pszItemName" parameter?
-
In the
IActiveScriptParse->AddScriptlet method what is the difference between the
pstrDefaultName, pstrItemName and pstrSubItemName arguments?
-
Can the
IActiveScriptParse->AddScriptlet method be used to add general functions to
a script that are callable by the script passed to the engine via
IActiveScriptParse->ParseScriptText?
-
Is there an
example of a host using IActiveScriptParse->AddScriptlet?
-
Why does my app
crash inside OLEAUT32.DLL after I call IActiveScript::InterruptScriptThread?
-
What is the state
of the script engine after calling IActiveScript::InterruptScriptThread?
-
What are the
semantics of IActiveScript::Clone?
-
How can I add 2 or
more sets of script text to the engine via IActiveScript->ParseScriptText
and get back an Idispatch pointer for each script?
-
What is error code
0x80020101?
-
How can I run a
script using the security credentials of the client?
-
I'm getting script
error 0x8000FFFF when trying to move to the CONNECTED state after my script was
terminated by InterruptScriptThread. What am I doing wrong?
-
Why would I get a
'Catastrophic Failure' HRESULT back from from either ParseScriptText or from
SetScriptState?
-
Why does the
documentation state that I can call IActiveScript::SetScriptState from a
secondary thread, but I get a ‘Catastrophic Failure’ HRESULT back when I try to
call it?
-
Why would I get a
‘Catastrophic Failure’ HRESULT (0x8000FFFF) back from
IActiveScript::GetScriptDispatch?
-
How can I
implement "modules" functionality in my host similar to what the Microsoft
Script Control offers?
-
What is the
expected behavior of the flags that can be passed to
IActiveScript::InterruptScriptThread?
-
How can I
programatically access the global variables & functions in a script?
-
Why does
IActiveScriptError::GetSourceLineText return E_FAIL when called after a runtime
error occurs?
-
Are there any
special flags I need to pass to IActiveScript::AddNamedItem() in order to parse
a script in a named context?
-
Is there any way
to save parsed code into a binary format to eleviate having to re-parse the
code at a later time?
-
How can I pause
and then resume the execution of a script from where it was paused?
-
Which IPersistXXX
interface should I use to load source code (script) into an engine?
-
What would be the
proper way to terminate a script from an automation object method that was
added using AddNamedItem? I've tried InterruptScriptThread, then
SetScriptState(SCRIPTSTATE_DISCONNECTED), doing this this fires an error on the
next line of code following the method that quits the script. Also tried
calling OnScriptTerminate directly, somewhere in this mixture has to be a clean
way to exit.
-
How can I support
multiple scripting languages such that scripts written in one language can call
scripts written in another language (ie. VBScript calls Jscript, etc)?
-
Can the Dispatch
pointer retrieved with GetScriptDispatch() be passed between threads?
-
How can I safely
use a script interface (like an IDispatch pointer) in a secondary thread if
that thread doesn't own the interface?
-
What is the best
way to reset the scripting engine between uses?
-
What is the
purpose of the IActiveScriptParseProcedure interface?
-
What is the
purpose of the IActiveScriptStats interface and methods?
-
Is there a
complete description of the multithreading support within Active Scripting?
-
Why would
IActiveScript::InterruptScriptThread return E_INVALIDARG if I know the
parameters passed to InterruptScriptThread are valid?
-
Why does
IActiveScript::InterruptScriptThread not terminate a running script immediately
when I'm trying to kill the script engine?
-
How can I
save/restore the values of script variables between runs?
-
What is the
difference between the IActiveScript interface and the IScriptControl
interface?
-
Is there a way I
can access the parameters of an event within a script added via
IActiveScriptParse::AddScriptlet?
-
What are the
correct HRESULT values to return when using the interface
IActiveScriptSiteInterruptPoll?
Hosting – Debugger
Hosting – Objects & Events
-
What interfaces
do my COM objects need to support so the script engine can connect to fire
events?
-
What is the best
way to add event handling code to the script engine?
-
What is the best
way to design my objects so that they will be compatible with Active Scripting?
-
I know JScript
has dynamic object support whereby I can add methods and properties
"on-the-fly" in my script. How can I add support for this in my objects?
-
Can I use my own
interface design to sink events from my objects, or do I need to use the
IConnectionPoint interface?
-
After adding an
Automation object to the script engine’s namespace, how do I respond to its
events?
-
Why would
IDispatch->Invoke get called with an ID of zero for an automation object in
a script?
-
Can an
automation object’s methods use types other than VARIANT’s?
-
Why would
further calls to automation objects fail after calling IActiveScript->Clone?
-
Where can I
find information on the IDispatchEx interface?
-
Where can I
find more information regarding the IProvideMultipleClassInfo interface?
-
My automation
objects change dynamically between invocations of a script. How can I ensure
that GetItemInfo is called by the ScriptEngine such that changes in any of the
objects can be taken account of by me by passing back the correct IUnknown and
ITypeInfo pointers from GetItemInfo?
-
Can I pass
simple data types like integers or strings to a script without creating an
automation object to contain them?
-
How can I
check the version of the TLB (type library) of an object within a script?
-
How can I
expose arrays of values within my object to a script?
-
When the
script engine calls IActiveScriptSite::GetItemInfo() with the flag
SCRIPTINFO_ITYPEINFO, how can I return the proper type library information for
the object?
-
Will the
script engine call my object’s IDispatch::GetIDsOfNames() method more than
once?
-
How can I
parent a window or dialog (that I create from within my object) to my
application rather than the desktop?
-
How can I sink
events for objects that are created at runtime within my script (ie using
VBScript’s CreateObject() function)?
-
When I use On
Error Resume Next in a script, any run-time error does not generate a call to
either OnScriptErrorDebug or OnScriptError. We seem to go right to
OnLeaveScript. Is this the expected behavior ?
-
Where can I
get more information on writing a collection object that can be accessible from
VBScript?
-
When does the
IActiveScriptSite::GetItemInfo method get called by the engine?
-
I want to
expose my top-level object’s properties and methods without having to specify
the object’s name in a script. How can I do this?
-
What’s a fast
way to fire events from code to a script?
-
I’ve created a
host and an object, but the host won’t sink any events. What am I doing wrong?
-
Can a script
detect when the method IActiveScript::InterruptScriptThread is called by a
host?
-
How do I add
constants such that they are usable from within my scripts?
-
How can I
remove a "named item" from the engine (after previously calling
IActiveScript::AddNamedItem) without using Clone?
-
What is the
correct way to access the automation data types such as Array, Date, etc from a
host?
-
Why would I
receive the message "Access Denied" after putting up a MessageBox within my
code after being called by a script?
-
What are the
differences between JScript and VBScript in the support of the IDispatchEx
interface?
-
How do I
return error codes from an object to a script?
-
How can I
disable MsgBoxes from being displayed for my objects?
-
Does the
script engine support reentrant calls to object methods?
-
How can I
return more than 1 value from a object method in VBScript & JScript?
-
How do I get
all the global constants defined in a script?
-
Do I need to
implement a function in my host to allow the script engine to instantiate my
automation object?
-
In the
IDispatchEx::InvokeEx method, what is the purpose of the DISPID_THIS and
DISPATCH_CONSTRUCT parameter values?
-
If I have a
dual event interface, why does my application crash if I attempt to call
methods on the custom interface portion?
-
How can I pass
a parameter into a script so that it can be used in any function in the script
(like a global variable)?
-
If I want to
use the IDispatch interface I get from calling
IActiveScript::GetScriptDispatch, can I safely cache it, or do I have to call
GetScriptDispatch everytime?
Hosting – Microsoft Script Control
Hosting – Miscellaneous
Language Engines - General
Language Engines - VBScript
Language Engines - JScript
-
Does Microsoft
have a FAQ document for JScript?
-
I’m trying to
decide between JScript & VBScript. Which one should I go with?
-
Why can’t I
use the JScript function "alert()" in my script?
-
How can I get
JScript to ignore event handlers for objects that don’t yet exist in my script
(because they are added at runtime), but activate them once the objects do
exist?
-
Can I use
SAFEARRAY’s with JScript?
-
How can I
access JScript Array’s within my script host that were created in a script?
-
How can I
write to a JScript Array from within my script host that was created in a
script?
-
Why do I have
to call IActiveScript::AddScriptlet to connect an object to JScript event
handling code, but not for VBScript?
Language Engines – PerlScript
Language Engines – PythonScript
Language Engines – TclScript
-
Where can I
get a copy of Tcl Script?
Language Engines – HaskellScript
-
Where
can I get a copy of Haskell Script?
Language Engines – RubyScript
-
Where can I
get a copy of Ruby Script?
Language Engines – LuaScript
-
Where can I
get a copy of Lua Script?
Log
-
New Entries
-
Changed
Entries
-
History
Copyright ©
1999-2004 Mark M. Baker