Re: Writing my 1st VBS "Script Component"



"Justin Piper" wrote:

I wouldn't advise it. Set = Nothing is not the only reason a script
component's reference count might decrease. Returning from a function
could cause it, if the component were assigned to a variable local to that
function. Stack unwinding following an error could, as well.

I'm not sure you understood my point. All I was saying is
I never use objects derived from other objects after the
source object is vacated; I always vacate the drived object first.

I was looking for your agreement that this practice would avoid
the problem you described in your original comments. In that
example, you did something I would never do.

It would be much safer, and not significantly more involved, to define a
second component in the same package and use CreateComponent to return it.


Frankly, I don't really understand what you did here. But I
won't worry about that now.


2) Using GetObject and the "script:" URI scheme to create an instance
using the name of the WSC file. There's a good overview of this technique
on Eric Phelps's website.

http://www.ericphelps.com/scripting/samples/wsc/_readme.txt



Thanks for the link. Actually, thanks a lot! Looks like a great site!


How do I package up these things and be assured that
IntelliSense™ will ALWAYS work [in MS Editors]?

I'm not positive, since I rarely an editor that has IntelliSense support,
but you shouldn't have to do anything aside from explicitly including a
<parameter> element for each argument your methods take.



I generally try to get the IntelliSense to work as a practical
matter while writing code; it prevents many mistakes. Also,
it reassures me that my various enumerated constants work,
etc., without having to include a constants file (although this
is sometimes a better choice for speed).

Keep in mind I write VBScript almost exclusively for IIS / ASP
Classic. Some VBS and WSH things don't work there, just as
some others don't work on the client side script in MSIE.

I guess ASP Classic is the only context where the #Include
directive works. I got into Script Components looking for ways
to avoid always bring code along with includes. This is
because code in the include (like commonly-used functions
and classes) will not come through to the IntelliSense, even if
they do work perfectly when the asp file runs.

I thought I might somehow use Script Components or Scriptlets
(or whatever these are) to create valid references to my VBS
code library -- thereby allowing me to keep one just copy of the
library (as I do with the #Include technique) but also to get the
constants -and- IntelliSense (as I do when I copy the whole
library into the botomm of each and every file.

As far as I can tell, this is the only newsgroup to talk to for the
ASP Classic (i.e., not dotNET) IIS environment with VBScript. Is
there another one, a better one? {I know 10 years seems like
a long time to twenty-somethings, but is a ~friggin' blink of an
eye to us normal people.}

All help is welcomed. Thanks Justin and everybody.

Jim Rodgers

.



Relevant Pages

  • Re: References for VBA
    ... >>> in Access, it's the mso constants that aren't defined, so ... ... >> Why would that give a good indication of the reference that was ... > then as soon as I type that "(" I get the IntelliSense dropdown list ... > Jean-Guy Marcil - Word MVP ...
    (microsoft.public.word.vba.userforms)
  • Re: interesting...
    ... > Be careful when mixing VBScript classes and script components, ... component does not increase the reference count on the component. ...
    (microsoft.public.scripting.vbscript)
  • Re: Annoyance: Intellisense doesnt work for referenced typed data
    ... Rebuild project and hopefully the intellisense will come back... ... go to reference will often jump to the wrong reference.cs... ... > Original post was made by Mike in MSDN newsgroup: ...
    (microsoft.public.dotnet.framework.adonet)
  • interesting...
    ... > Be careful when mixing VBScript classes and script components, ... component does not increase the reference count on the component. ...
    (microsoft.public.scripting.vbscript)
  • Re: Managed Code
    ... you have to add a reference to a DLL in order for its ... The reason why you have some intellisense ... "Bob" wrote in message ...
    (microsoft.public.dotnet.framework)

Loading