Copyright: Persistent Progress Bars by Richard A. DeVenezia
Citation: * Persistent Progress Bars - Copyright Richard A. DeVenezia, 2000-2001 *


Copyright
Freeware License - Yada, yada, yada

Copyright Installation Concepts Commands Examples	Persistent Progress Bars is protected by Title 17 United States Code and international convention, and remains the property of Richard A. DeVenezia, the Publisher. The Publisher grants the User a nonexclusive, nontransferable license to copy and use the program, data and documentation (collectively referred to hereafter as the "software") in accordance with the terms and conditions of this Agreement. The User shall always copy the software, trade name and copyright notice in its entirety without any additions, deletions or modifications whatsoever. The User may use the software (or any part thereof) for any commercial purpose whatsoever, without the prior written permission of Publisher. The Publisher provides the software "as is" and "with all faults" without any express or implied warranties whatsoever. Because of the diversity of hardware and software configurations under which this software may be installed and used, no warranty of merchantability, performance or fitness for a particular purpose is offered. The User shall test the software thoroughly before relying on it. The User assumes the entire risk of using the software. PUBLISHER AND ITS AGENTS SHALL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER RESULTING FROM USE OF THIS SOFTWARE.
Richard A. DeVenezia

9949 East Steuben Road

Remsen, NY 13438

radevenz@ix.netcom.com


Installation

Copyright Installation Concepts Commands Examples	Persistent Progress Bars is distributed in two different ways. In a zip file containing three entries: ppbS.exe ppbS.hlp ppbS.cnt In a self extracting zip executable: ppbSx.exe You can unzip these files to any directory and run ppbS from there. No special installation or registration is necessary.  ppbS.exe does rely on common control files which are installed as part of Internet Explorer 3.0 and higher.


Concepts: What is a Persistent Progress Bar ?
What is a persistent progress bar ?

Copyright Installation Concepts Commands Examples	The persistent progress bar A persistent progress bar (ppb) is an object that lives outside the domain of a single program.  It can be manipulated from various points within a single program, from various points within several programs and from various points between program invocations. The persistent progress bar server A persistent progress bar (ppb) is controlled from the server program named ppbS.  ppbS can create and control up to 20 independent ppb’s through the use of command line options.  Most people will need to have only one ppb active at a time. When a persistent progress bar window exists, so does the ppbS window.  ppbS starts as a minimized application that appears in the taskbar.  If you restore the ppbS window it looks like this: The window reminds you that it is the server, and if closed by you, so will all the ppb’s you created.  Attempts to control a closed ppb will restart the server, and the ppb commands will be ignored since there is no active ppb.


Command Line Options
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

Each verb and it’s arguments are listed here.

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y


Help
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

Help

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	This help document is displayed. DOS> ppbs help


Shutdown
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

Shutdown

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	All ppb’s are destroyed and the server terminates, closing it’s window. DOS> ppbs shutdown


Create
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

Create “Title of Window”

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	Each window created is given a number from 1 to 20 in succession as they are created.  This number is used as an argument for other verbs.  When a window is created it is located at the center of the screen, plus a small offset if other ppb windows are also open.  When a window is destroyed, and a new window is created it will have the same number as the one just destroyed. DOS> ppbs create “Working on it...”


Destroy
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

Destroy N

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number to destroy. DOS> ppbs destroy 1


SetText
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

SetText N “Informative Text”

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number. The text after N is placed above the progress bar.  Enclose in quotes any text that contains spaces. DOS> ppbs settext 1 “Step 1 in progress”


ShowPct
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

ShowPct N yes|no

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number. When no text has been set the % progress is shown without parenthesis. DOS> ppbs showpct 1 yes


SetPos
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

SetPos N M

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number. M is the percent progress, 0 to 100. DOS> ppbs setpos 1 30


CrawlToPos
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

CrawlToPos N M

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number. M is the percent progress, 0 to 100, to crawl to. CrawlToPos should be used before a lengthy process starts.  The ppb will continue to update while the lengthy process is running. When the crawl to position is reached the position is reset to the starting position.  The starting position is what the progress bar was at when the crawl first started.  It is a good idea to use SetPos between two CrawlToPos uses. The ppb increments one percent every 125 milliseconds (8 times a second).  This rate can be changed using SetCrawlTime or SetCrawlSpeed. DOS> ppbs crawltopos 1 50


Crawl
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

Crawl N

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number. Crawl should be used before a lengthy process starts.  The ppb will continue to update while the lengthy process is running. Crawl loops continuously from 0 to 100.  You would probably not want to show the percent while doing this crawl. The ppb increments one percent every 125 milliseconds (8 times a second).  This rate can be changed using SetCrawlTime or SetCrawlSpeed. DOS> ppbs crawl 1


SetCrawlTime
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

SetCrawlTime N M

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number. M is the time in milliseconds that the entire crawl should take. The ppb will increment one percent every M / (crawl range) milliseconds. M < 500 is not recommended. DOS> ppbs setcrawltime 1 1000


SetCrawlSpeed
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

SetCrawlSpeed N M

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number. M is the update interval in milliseconds. The ppb will increment one percent every M milliseconds. DOS> ppbs setcrawlspeed 1 250


MoveWindow
Controlling a persistent progress bar

Command line options of the ppbS program are used to control a ppb. Every manner of control over a ppb is managed through a verb and verb arguments.  You can have any number of verbs in the command line.

MoveWindow N X Y

Help Shutdown Create "Title of Window” Destroy N SetText N "Informative Text” ShowPct N yes|no SetPos N M CrawlToPos N M Crawl N SetCrawlTime N M SetCrawlSpeed N M MoveWindow N X Y	N is the ppb window number. X Y are the new screen coordinates for the window (upper left hand corner). DOS> ppbs movewindow 1 10 10


Examples

Here are some examples using a Persistent Progress Bar.

Batch Files SASCBTBL SAS Program


Batch Files
Examples

A batch file example

Batch Files SASCBTBL SAS Program	Important note for Windows NT users: The first ppbS command in a batch file must be invoked using the NT start command.  If it is not, the batch file can ‘hang’ at ppbS.  Additionally, the start command does not run reliably the command/program when it is specified within double quotes (which is necessary when the program or path to program contains spaces) A sufficient technique appears to require a change to the path environment variable.
Backup.bat

@echo off

set ppbPath=C:\Program Files\ppb

set pathHold=%path%

set path=%ppbPath%;%path%

start ppbS

ppbS create "Backing Up Data" ShowPct 1 yes Crawl 1 SetCrawlTime 1 120000

ppbS settext 1 "Archiving January..."

c:\pkzip c:\temp\jan.zip c:\data\jan\*.dat

ppbS settext 1 "Archiving February..."

c:\pkzip c:\temp\feb.zip c:\data\feb\*.dat

ppbs shutdown

set path=%pathHold%

set pathHold=

set ppbPath=


SASCBTBL
Examples

SAS Example - Describing WinExec() in SASCBTBL

Batch Files SASCBTBL SAS Program	SAS® software is a registered trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.  SAS Institute Inc. is located at SAS Campus Drive, Cary, North Carolina 27513. You can learn more about SAS at http://www.sas.com.

SAS users can run Windows programs using a variety of commands and statements, including X, system(), and Fileref pipes.  All these techniques will, on occasion, flash a DOS box window open and close as the command starts and finishes.  This flashing is an annoyance.

SAS users can also run code in .dll’s.  The following SAS code defines a SASCBTBL interface to the Windows API routine WinExec().  WinExec() runs a Windows program and does not flash a DOS box.

The SAS moduleN() routine can be used in a Data Step or SCL to call the WinExec() routine to run the ppbS program. Example

filename sascbtbl catalog 'work.sascbtbl.winexec.source';

data _null_;

file sascbtbl;

input;

put _infile_;

cards4;

routine WinExec

minarg=2

maxarg=2

stackpop=called

module=KERNEL32

returns=SHORT;

arg 1 char format=$cstr200.;   * lpCmdLine;

arg 2 num  format=pib2.;       * nShowCmd;

;;;;


SAS Example
Examples

SAS Example - A program using WinExec() to run ppbS

Batch Files SASCBTBL SAS Program	SAS® software is a registered trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.  SAS Institute Inc. is located at SAS Campus Drive, Cary, North Carolina 27513. You can learn more about SAS at http://www.sas.com.

* replace with installed location of ppbS;

%let ppbs = I:\vcProjects\ppbS\Release\ppbS.exe;

data _null_;

  rc = modulen("WinExec","&ppbs Create ""SAS is working on it""",0);

  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VSLIB"" crawltopos 1 20",0);

run;

data _null_; set SASHELP.VSLIB; run;

data _null_;

  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VSTABLE"" setpos 1 20 crawltopos 1 40",0);

run;

data _null_; set SASHELP.VSTABLE; run;

data _null_;

  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VMEMBER"" setpos 1 40 crawltopos 1 60",0);

run;

data _null_; set SASHELP.VMEMBER; run;

data _null_;

  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VCATALG"" setpos 1 60 crawltopos 1 80",0);

run;

data _null_; set SASHELP.VMEMBER; run;

data _null_;

  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VCOLUMN"" setpos 1 80 crawltopos 1 100",0);

run;

data _null_; set SASHELP.VCOLUMN; run;

data _null_;

  rc = modulen("WinExec","&ppbs Shutdown",0);

run;

** a longer running example;

data _null_;

  loops = 2e6;

  updates = 20;

  command = "destroy 1 create ""Looping " || trim(left(put(loops,comma15.))) || " times""";

  rc = modulen("WinExec","&ppbs " || command,0);

  rc = modulen("WinExec","&ppbs showpct 1 yes",0);

  updaten = loops/updates;

  do i = 0 to loops;

    if mod (i,updaten) = 0 then do;

      command = "setpos 1 "      || put(i/loops*100,3.)

             || " crawltopos 1 " || put(i/loops*100+100/updates,3.);

      rc = modulen("WinExec","&ppbs " || command,0);

    end;

  end;

  rc = modulen("WinExec","&ppbs shutdown",0);

run;