Script Service newObjects Script Service

The Script Service is a simple but powerful FREEWARE tool. It allows you to write Windows NT/2000 service in script. What is the effect? You have your script running. It receives calls to a procedure called "OnTimer" on configured intervals (up to this point this is simply a scheduler), but also any external application is able to call functions implemented in this script! Thus you are able to write something that receives requests for asynchronous execution and then ask it from time to time for their state. If you have problems how to implement maintenance pages for DB management (regular tasks), or news mail sending, or other problems not possible to happen during the ASP page execution - then this is what you need.

Please take a look at the Modes chapter before using the service. For convenience it supports two modes - service and application. The second mode is implemented for Windows 98 support and as more convenient during the initial script development.

How it works?

You are registering the scpsvc.exe to run in service mode. The you need to write a few lines of configuration - what script to load, in which language is it, set a log file, set timer interval. Then you can start the service. The script is loaded and its OnTimer sub is called each time the specified interval has elapsed. VBScript and JScript have access to the system time thus the interval is not very important - your script decides when to do something. You implement some tasks in the script and in OnTimer you need to implement their invocation for example call one at midnight and call other at noon. Then you can write other subs and functions intended to be called from your ASP pages. Their purpose will be to record some tasks to be done or retrieve information about them. Then in your ASP pages that need to do something that will cause timeout if done in their code will just call your "add-task" function for example and tell the user your request has been recorded. Then he/she may come back later and check if it is fulfilled. Or another scenario - you wrote in a data base record that should cause some task to be done later (send mail or management task may be). Then you can prepare another ASP page that checks its state or invokes it explicitly - to be done immediately by calling a routine in your script that changes the schedule for it and/or executes it before returning.

The script running in the service acts just like a system wide object available for all the applications. They are able to call its methods, invoke reload (if configuration is changed for example), share data between each other etc.

The interface

The Script service is accessible as creatable object. You request it and through it the running script can be accessed or general commands (reload, terminate) can be executed. It is very simple only a few simple methods and properties.

The configuration

The configuration file must be in the directory where the scpsvc.exe resides and must be named scpsvc.cfg. See the configuration settings for details.

Additional components:

The service ships with the newObjects ActiveX Pack1. It uses internally the ScriptManager2 ActiveX and all the other objects are available for your script too. Its documentation is include with the Script Service. For samples explicitly related to the components in the pack download it from our site. The binaries are already installed by the Script Service and you may just get the samples directory from the downloaded package without installing it. The ActiveX pack contains many different components - see its documentation.

newObjects Copyright 2001-2006 newObjects [ ]