Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using WScript.StdIn in a Windows Script Component

Status
Not open for further replies.

cchipman

IS-IT--Management
Sep 16, 2002
125
0
0
US
I created a script component using the Windows Script Component Wizard, and was able to register the component.

I've run into trouble, as the purpose of the component was to provide some text input using

Code:
Dim StdIn:  Set StdIn = WScript.StdIn

However, I get an error message of the following type:

[50,15] ActiveX component can't create object WScript.

Is there a way I can get the WScript Object? Should I just pass it in?

Help?
 
Nevermind... answered my own question. To make it work you

a) add the following get/set pair in the XML component area:
Code:
	<property name="scriptObject">
		<get/>
		<put/>
	</property>

b) create the object in the CDATA (VBScript) section.

Code:
Dim scriptObject
Set scriptObject = Nothing

Dim StdIn
Dim StdOut

c) modify the set code to point the stdin and stdout properly like such:

Code:
Function put_scriptObject(newValue)
	Set scriptObject = newValue
	Set StdIn = scriptObject.StdIn
	Set StdOut = scriptObject.StdOut
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top