mr_unreliable
Tue Jul 31 12:34:19 CDT 2007
Herby wrote:
> So is there a limit on the text that you can add to the global module?
> How can i resolve this problem?
>
Herby, your o.p. indicated problems with a blob of code
being entered into the "global scope" of the script control.
I suggested that maybe you had exceeded some internal buffer
space, which might be circumvented by using the AddObject
method to add "objects" (or instances of class code) to
extend the amount of code you could insert into the
script control.
You said that you suspected that the "object's" methods and
properties would have to be prefixed with the name of the
object (myObject.myMethod), and this additional burden of
coding script was unacceptable to your users.
There may be some hope of circumventing this, based on some
careful reading of Francesco Balena's article: "Exploring
the Microsoft Script Control", found here
http://www.microsoft.com/mind/0799/script/script.asp
--- <quote> ---
Things become more exciting when you pass an object to the
AddObject method and specify that the object is to be
considered _global_ in the script, which you do by passing
a third argument equal to True:
Dim clsShared As New SharedClass
ScriptControl1.AddObject "oSHC", clsShared, True
A global object doesn't need to be referenced explicitly when
invoking its properties and methods, which means that the
properties in SharedClass now appear to the script as regular
variables, and that the methods in the class can be now invoked
as regular VBScript procedures and functions.
--- </quote> ---
Uh-oh. Is this some undocumented feature that I missed? Well
no, it was there all the time. Look it up in your msScript.ocx
documentation.
--- <quote (in part) > ---
ADDOBJECT METHOD
Syntax
ScriptControl.AddObject(name, object[, addMembers])
The AddObject method has these parts:
Part Description
---- -----------
name Required. Name by which the added object is to be
known in ScriptControl code.
object Required. Name of the object exposed at run time.
addMembers Optional. Boolean value. True if members of object
are GLOBALLY ACCESSIBLE; False if they are not.
--- </quote> ---
In summary, there is a way, using AddObject to add code to the
script control's "global module" (code).
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)