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

Boxes Functions
plus
plus

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

How to Display a Box While Processing in the Background

Keywords: boxesup display box dialog box Intcontrol 47 Intcontrol(47 

Question:

Hi, I wonder if someone can help. What I want to do is to use a dialog box in Winbatch to display certain messages as the WBT file executes, thereby keeping the user informed of progress. I know that you can use the Display function to do this, but I want a Dialog Box to stay on the screen all the time (until the WBT terminates) and the text in the dialog box to change with each new message. In addition, I do not want the users to have to acknowledge each of the messages, thus no buttons should be displayed.

Answer:

No problem.

Look in the Winbatch help file (NOT the WIL help file) for BoxOpen, BoxText, BoxTitle and BoxShut. If you limit yourself to those 4 box functions, then you do not need to worry about the rest. Use BoxOpen() and BoxText() to display status information. Note that these functions do not create dialog boxes with pushbuttons.

Do something like:

	BoxOpen("Hello","Initializing") 
	  for xx = 1 to 1000 
	BoxText("xx = %xx%") 
	  next 
	BoxText("Complete") 
	TimeDelay(5)
	Display(5,"All","Done") 
	BoxShut()

Also look in the SAMPLES directory for the Box drawing demo.

Question:

How do I shut a box after the application I'm waiting for finishes, if I am NOT launching the application from within my existing WinBatch script?

Answer:

Basically, you're going to pass parameters to close the WinBatch Box script. Here's a sample script. You'll have two copies of this compiled EXE running; the second EXE that's launched will close the box:
;This script requires three parameters
;parameter 1  OPEN or CLOSE
;parameter 2  Desired title to open or close ; must have param2 so it knows what it's closing
;parameter 3  (only required for open)	Desired text to display

;NOTE you may need to put double quotes around param2 and param3 to get them
;to pass properly.  If your application won't let you pass the parameters to WinBatch
;surrounded by double quotes, then use something like underscores to separate your
;parameters.  If you're passing your parameters out of your application with
;underscores between the words, then you'll need to do a strreplace for those underscores
;once they get interpreted by WinBatch, as in the following:

param1=strlower(param1)
if param1=="open"
   param2=strreplace(param2, "_", " ")
   param3=strreplace(param3, "_", " ")
   BoxOpen(param2,param3)
   while 1
      TimeDelay(1)             ; set some suitable delay
      fred=WinName( )          ; checks the name of the current WinBatch window
      if fred == "CLOSE" then exit
   endwhile
endif

if param1=="close"
   param2=strreplace(param2, "_", " ")
   WinTitle(param2,"CLOSE")
   exit
endif
NOTE: Read the section on "Stack Management" using BoxDataTag and BoxDataClear, in the WinBatch.HLP file.

If you use ONLY BoxOpen/BoxTitle/BoxText/BoxShut then we manage the stack for you. But as soon as you use any other box function then you may encounter stack problems in a long run.

If you code works perfectly and it always does the same number of Box Commands - then no problem. However, if your processing can vary - like processing a variable number of files in a directory - and you could execute LOTS of Box functions -- then you may need to start worrying about drawing stack management.

Question:

How do I shut a box after the application I'm waiting for finishes, if I *am* launching the application from within my existing WinBatch script?

Answer:

You can use the IntControl 47 function to kill the main WB script from secondary one.
Article ID:   W12761
Filename:   Display a Box While Processing in Background.txt
File Created: 1999:04:15:16:49:26
Last Updated: 1999:04:15:16:49:26