Re: Writing my 1st VBS "Script Component"
- From: Jim Rodgers <JimRodgers@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 20 Jul 2007 22:26:01 -0700
"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
.
- Follow-Ups:
- Re: Writing my 1st VBS "Script Component"
- From: mayayana
- Re: Writing my 1st VBS "Script Component"
- References:
- Re: Writing my 1st VBS "Script Component"
- From: mr_unreliable
- Re: Writing my 1st VBS "Script Component"
- From: Justin Piper
- Re: Writing my 1st VBS "Script Component"
- From: Jim Rodgers
- Re: Writing my 1st VBS "Script Component"
- From: Justin Piper
- Re: Writing my 1st VBS "Script Component"
- Prev by Date: Re: Inventory Script
- Next by Date: Re: Writing my 1st VBS "Script Component"
- Previous by thread: Re: Writing my 1st VBS "Script Component"
- Next by thread: Re: Writing my 1st VBS "Script Component"
- Index(es):
Relevant Pages
|
Loading