I don't know VBscript at all but I know VB well. I am trying to learn VB script. I have found numerous examples that use the above but I get Error Object required WScript when I run them.
[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
Ok, so you are running it in a web page (not asp admittedly but a web page none the less). So use MsgBox instead of WScript.Echo.
[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
Show us a VBS file where WScript.Echo does not work. I have never had an issue with that. What you posted before was HTML with embedded VBS.
[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
into a file named foo.vbs. Then double click foo.vbs and you get an error?
[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
That would be indicative of a corrupt Windows Script Host installation or configuration. You might want to uninstall and re-install.
[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
>in a .vbs file WScript.echo "XXX" doesn't work
What do you mean "doesn't work"???! I suppose it does not mean there be an error message coming from wsh!? The basic thing you have to check the file association to .vbs. The default action "open" should look something like this or some variation of it if you'd edited it.
[tt] C:\WINDOWS\System32\WScript.exe "%1" %*[/tt]
Then it is something in your environment. That is a hard thing to troubleshoot without access to your environment. Just to be sure that we are all on the same page, please follow these steps:
1) Open a command prompt
2) Type: cd \temp <ENTER>
3) Type: echo WScript.Echo "XXX" > foo.vbs <ENTER>
4) Type: cscript.exe foo.vbs <ENTER>
Verify that you then get an error and please post the error that you get.
[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
Thanks, EBGreen. That worked. When I run it from windows I dont see the output. In javascript I see a message box. I guess thats just the way it operates (i.e. in VB script you can only see the output if you run from the command line). Thanks again.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.