I am writing an application that uses the Microsoft Script Control to run
VBScripts. The VBScripts then interact with our internal data.
I want to write output, to the console the program is running in, from
within my script. If I run the following test script with the cscript.exe
program it works without a problem:
vbfoo
Sub vbfoo()
WScript.StdOut.Write "Hello World"
End Sub
However, when I fun the same script from within the ScriptControl, I get the
following error:
Object required: 'WScript'
Any ideas on how to write to StdOut from within the ScriptControl?
This was copy/pasted from a VB/VBA object browser...
================================================
Function GetStandardStream(StandardStreamType As StandardStreamTypes, [Unicode As Boolean]) As
TextStream
Member of IWshRuntimeLibrary.FileSystemObject
StandardStreamTypes
Const StdErr = 2
Const StdIn = 0
Const StdOut = 1
--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--
"Julian Catchen" <julian.m...@intel.com> wrote in message news:96hg72$6...@news.or.intel.com...
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/
dim sout
set sout = GetStandardStream(StdOut)
sout.Write "Hello World"
But I keep getting type mismatch errors.
"Michael Harris" <mik...@mvps.org> wrote in message
news:ez0PMf9lAHA.2016@tkmsftngp02...
dim sout, oFS
const StdOut = 1
set oFS = CreateObject("Scripting.FileSystemObject")
set sout = oFS.GetStandardStream(StdOut)
sout.Write "Hello World"
I didn't take time to confirm this.
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/
"Tom Lavedas" <lav...@pressroom.com> wrote in message
news:3A8D562C...@pressroom.com...
scrrun 5.1.x.x or higher (i.e., WSH 2.0+)