VBscript.echo

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

VBscript.echo

Post by armsys » Sat Dec 28, 2002 2:50 am

When running the following script:


VBSTART
Function Test
set fso = CreateObject( "scripting.FileSystemObject" )
if fso.FolderExists("c:\Windows") then
MsgBox("There is a folder name \Windows")
WScript.echo "There is a folder name \Windows"
end if
End Function
VBEND

VBEval>Test
Message>Ok


It always genrates Error 424: Object Required: 'WScript'.

Do I have to create an object instance for WScript in the Macro Scheduler script?

I'll be grateful for your help. Thanks.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Dec 29, 2002 11:53 pm

Since the newer version of Macro Scheduler has VB scripting support included, we will probably be discussing more vb code issues.

Could I suggest that a separate Forum Category be set up to deal with them separately?

I know that at times, they will not be able to be separated, but think it would be better to make the effort.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Dec 30, 2002 12:06 am

You will need to add the following line at the beginning of the VB script:

Dim fso As Object

Function Test()
Dim fso As Object
...
...
...


WScript probably also needs to be declared, but I am not sure what you are trying to do....The Echo Action can be used in Access to hide a macro, but that does not apply to Macro Scheduler macros.

If that line is left out, then the Message Box comes up OK after fso is declared.

Hope this helps....

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Dec 30, 2002 11:49 am

Hi Bob,

Thanks for your feedback. In actuality, it shouldn't casue too much problem to any Macro Scheduler script writer. Most VBScript bulit-in objects work perfectly in the Macro Scheduler script while WScript is the only notable exception. In the worst case, Macro Scheduler can EXE an external .vbs which includes the WScript methods and/or properties.

Again, thanks for your help. Happy New Year.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts