Source language: Translate to:

Wscript object

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Wscript object

Postby Tony Kroos » Fri Oct 16, 2009 4:57 pm

Hello, can anybody explain me how to use WScript objects in Vbscript functions? I need WScript.Sleep method, but when I use it an error appears. I see that all WScript. -methods do not work in Neobook VBS-functions, is there any workarounds?
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby HPW » Fri Oct 16, 2009 10:45 pm

Have you looked at the wscript-posts here in the forum?
Using the search-function I get a lot topics.

For example:

http://www.neosoftware.com/forum/viewto ... ht=wscript

http://www.neosoftware.com/forum/viewto ... ht=wscript

http://www.neosoftware.com/forum/viewto ... ht=wscript


Maybe that posts or other may help.
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Tony Kroos » Sat Oct 17, 2009 7:26 am

Of course, I used the search before asking, but did not find anything useful. If you reread my question, you'll understand what I mean. Just try to use WScript.Sleep method in your function and you get an error. Inexplicably, Neobook can not work with Wscript. - methods, because needs "Wscript" object to be created, but it is impossible to create such object.
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby HPW » Sat Oct 17, 2009 1:06 pm

I am not a VBS-Expert but when I google it there seems to be samples:

"http://msdn.microsoft.com/en-us/library/6t81adfd(VS.85).aspx"
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Tony Kroos » Sat Oct 17, 2009 1:31 pm

HPW wrote:I am not a VBS-Expert

HPW, big thanks for your replies anyway. As a scripts-expert, I must say that:
MSDN Library wrote:The WScript object is the root object of the Windows Script Host object model hierarchy.

so that is why it cannot be created by Neobook. I made some "workarounds" for .Sleep, .Quit and other WScript methods, but I dont like them, so I decided to ask Neobook's developers to solve this problem in correct way. So, is there any suggestions?
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby dpayer » Mon Oct 19, 2009 8:09 am

Tony Kroos wrote: I made some "workarounds" for .Sleep, .Quit and other WScript methods, but I dont like them, so I decided to ask Neobook's developers to solve this problem in correct way. So, is there any suggestions?


The exec method suggested by NB support didn't work?

http://msdn.microsoft.com/en-us/library/ateytk4a(VS.85).aspx

Can you describe what happens? (or what fails to run as you expect).

David P
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Tony Kroos » Mon Oct 19, 2009 9:06 am

dpayer wrote:The exec method suggested by NB support didn't work?

http://msdn.microsoft.com/en-us/library/ateytk4a(VS.85).aspx

I do not want to run external .vbs files, I am talking about internal neobook VBScript function. Just try to use this function sample in your pub, and you will get an error.
Code: Select all
{NeoBook Function}
Version=5,60
Language=VBScript
{End}
Wscript.Sleep (5000)
MsgBox ("5 seconds passed")

Now you understand what I am talking about?
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Neosoft Support » Mon Oct 19, 2009 10:58 am

Sleep is a method of the Wscript object. This object is provided by the Windows cscript and wscript host programs used to execute external VBScripts. For whatever reason, Microsoft decided not to include Wscript and its methods in the Windows Script Control which is used to execute VBScript from within an application like NeoBook.

There are alternatives for most Wscript method. For example, instead of Sleep, why not use NeoBook's Delay action in your VBScript:

Code: Select all
publication.nbExecAction( "Delay ""5000""" )
MsgBox ("5 seconds passed")
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Tony Kroos » Mon Oct 19, 2009 1:19 pm

Neosoft Support wrote:There are alternatives for most Wscript method. For example, instead of Sleep, why not use NeoBook's Delay action in your VBScript:

Code: Select all
publication.nbExecAction( "Delay ""5000""" )

Thanks, I forgot about this possibility... problem solved.
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest