WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Variables and Parameters

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to set up a State Controller with Global Variables

Keywords:     nested calls 

Question:

I just realized that WinBatch supports only six levels of nested calls. I need to be able to call another WIL program and exit the calling WIL program while keeping all global variables, i.e. I need to be able to chain from one main WIL program to the next without losing global variables.

I have not yet found a suitable WinBatch mechanism and request your advice.

The subroutine call is insufficient to develop state machines. I could store all global variables in a binary buffer and start the next WIL program with the run command, but I don't think that I should have to program my own global variables transfer mechanism; WinBatch should provide a solution. All other scripting languages I'm familiar with have a chaining mechanism.

Answer:

The trick here is to use a master WBT file as a "state controller".

It starts up and examines a state_flag (presumably set to an initial default value =1 ) and calls the routine responsible for that state (state1.wbt)

When state_1 is done, it sets the global variable state_flag and returns to the state controller, which then calls the next state.

This scheme only goes 2 levels deep. Laura wrote: > > Here's a user request for the list: > > --------------------------------------------------------------- > > Subject: Program Chaining in WinBatch > Date: Thu, 14 May 1998 23:51:03 -1000 > From: "Jacques D. Leibu" > To: "Inc Wilson Windoware (E-mail)" > > Aloha >


Article ID:   W13921
Filename:   Set up a State Controller with Global Variables.txt
File Created: 1999:04:15:16:57:18
Last Updated: 1999:04:15:16:57:18