Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WSH object or variable issue

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3099
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WSH object or variable issue
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 WSH object or variable issue - 5/24/2005 2:29:50 AM   
  JKW2068

 

Posts: 71
Score: 0
Joined: 4/14/2005
From:
Status: offline
I've got a short piece of code from an html file that shows an issue while trying to run a simple Sleep or Echo command. Whats interesting is with Option explicit, I get a variable is undefined 'WScript'. Not using Option Explicit, I get a Object required 'WScript'. If I put the code in a .vbs file (minus the html tags), it runs fine. Any ideas? Thanks guys.


      




*Update, Tested two systems. Same issue. Both systems have XP SP1 and 2 installed.
 
 
Post #: 1
 
 Re: WSH object or variable issue - 5/24/2005 2:43:45 AM   
  Zifter


Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
Those commands starting with WScript only work in 'standalone' scripts (.vbs or .wsf), you can't use them in webpages (HTML,ASP,HTA,...)
Example:
      becomes in a webpage
      

(in reply to JKW2068)
 
 
Post #: 2
 
 Re: WSH object or variable issue - 5/24/2005 2:48:13 AM   
  JKW2068

 

Posts: 71
Score: 0
Joined: 4/14/2005
From:
Status: offline
Ahhh. Thanks Zifter.

(in reply to JKW2068)
 
 
Post #: 3
 
 Re: WSH object or variable issue - 5/24/2005 3:37:33 AM   
  JKW2068

 

Posts: 71
Score: 0
Joined: 4/14/2005
From:
Status: offline
This is somewhat of an annoyance. Even if I use an external vbs file, it still will not allow the usage of WScript.

(in reply to JKW2068)
 
 
Post #: 4
 
 Re: WSH object or variable issue - 5/24/2005 8:48:13 PM   
  Zifter


Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
How do invoke your script? Are you using cscript.exe or wscript.exe? Are you sure WSH is installed and you got the latest version?
Here is a small test script, which will show the WSH version, script version and will then pause for three seconds.
Copy-Paste it to an empty textfile and save it with a .vbs extension, then run it with either cscript.exe or wscript.exe (in your system32 folder)
      HTH

(in reply to JKW2068)
 
 
Post #: 5
 
 Re: WSH object or variable issue - 5/25/2005 12:28:29 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
quote:
Originally posted by JKW2068

This is somewhat of an annoyance. Even if I use an external vbs file, it still will not allow the usage of WScript.


What do you mean by this? Are you calling a script from an HTML page? Post what code you have.

(in reply to JKW2068)
 
 
Post #: 6
 
 Re: WSH object or variable issue - 5/25/2005 1:42:20 AM   
  JKW2068

 

Posts: 71
Score: 0
Joined: 4/14/2005
From:
Status: offline
Simple HTML file calling external script which gives me the same error as it did when the script was embedded (Object required 'WScript')in the HTML file. Executing the .vbs file directly with either CScript of WScript works as it should. What am I doing wrong.

I am using
WSH 5.6
VBScript 5.6


      


      

(in reply to JKW2068)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WSH object or variable issue Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts