Automating Performance Gallery Gold
Performance Gallery Gold (PGG) contains a flexible, command-line driven automation facility.
These capabilities are most commonly accessed in two ways. The first is by customizing a
program shortcut to run PGG with command-line parameters on an as-needed basis. The second
is through a batch file that may be scheduled to run at given time(s) using the built-in scheduling
facilities provided with Windows 95 (with the Plus Pack) or Windows 98/ME/NT/2000.
Customizing a Shortcut
The following steps may be used to customize a Performance Gallery Gold shortcut:
Right-click on the Performance Gallery Gold shortcut and select Properties. A dialog window will pop up showing the contents of the shortcut.
There will be two tabs at the top of the dialog, General and Shortcut. Make sure that the Shortcut tab is the one that is currently being displayed. If it is not, left-click on the Shortcut tab.
The Target
field should be highlighted. Left-click in the field and move to the
end of the text. Insert a space (all commands should be separated by
spaces) and type in the desired automation commands (see "Automation Commands.", below).
When all of the commands are entered, click OK.
The next time the shortcut is used, the automation commands will be executed.
Batch Files
Batch files are text files that end with the .bat extension and contain commands that may be
issued without user interaction. They may be scheduled (see
"Scheduling for the Batch Files.",
below) to execute at given times and are very flexible. For simplicity, this explanation will only
cover the basics of using batch files to execute Performance Gallery Gold (PGG) in automated
mode, as well as adding an FTP command to the batch file to transfer files automatically to
another machine (usually a PC or server containing a web page that references the text and
images exported by PGG).
The following steps may be used to create a batch file for Performance Gallery Gold automation:
Start Notepad (under Start/Programs/Accessories/Notepad) or any text editor and open a new text file (Notepad will start with a new text file automatically).
Enter
the path and executable name of the currently installed copy of PGG.
This parameter must be enclosed in quotation marks if it contains any
spaces or special characters other than the colon and reverse slash.
This file will only have one line of text. Do not insert a hard return.
Refer to "Example Automation Settings".
Save the file with the .bat extension.
FTP in Batch Files
File Transfer Protocol (FTP) is commonly used to transfer files between computers on the
Internet. A command line version of FTP is included with Windows 95/98/ME/NT/2000. As a
command line executable, FTP may be included in a batch file to be run either by itself or in
combination with Performance Gallery Gold.
This capability can be used to transfer either the data file to the Windows machine running
Performance Gallery Gold (PGG) or to transfer the resulting images and tables produced by PGG
to a desired web server.
|
NOTE
The following instructions assume that the machines that will be
conducting the transfer are properly configured for TCP/IP networking
and that the user has a FTP-capable login on the source machine to the
desired file(s) and that the source machine has an operational FTP
server service running.
|
The following steps may be used to transfer a data file from a machine generating a data file to
the machine that will process it using Performance Gallery Gold's automation facility:
Start Notepad (under Start/Programs/Accessories/Notepad) or any text editor and open a new text file (Notepad will start with a new text file automatically).
Enter the cd
(change directory) command followed by a space and then the name of the
directory that you want the file to placed in, as in the following
example:
cd "C:\My Documents"
Press Enter to go to the next line.
Enter in the FTP command followed by the -i switch and the -s:<filename> switches. The -i
switch disables prompting for the transfer of multiple files, otherwise
user interaction would be required to perform multiple file transfers.
The -s switch specifies a file that contains
instructions for the FTP command - essentially a batch file specific to
FTP. This will be the next file that we create. The following example
displays the correct format:
ftp -i -s:"C:\My Documents\PGGftp.txt"
Save the file with the .bat extension.
Close
the file and open a new, blank one. This file will contain the
instructions to give the FTP command in order to transfer the file.
Enter
in the open command followed by the name of the machine to get the data
file from. Normally, it is good form to use the full name of the
machine, including the domain name in this parameter.
open ftp.example.com
Press Enter to go to the next line.
Next type the name of the user that will be logging in to the remote machine.
Press Enter to go to the next line.
Type the password of the user mentioned above.
Press Enter to go to the next line.
Type bin
to set the transfer mode to binary (this not required if the default
setting for the FTP client is binary or if the data file is an .smf text
file).
Press Enter to go to the next line.
Type the get command with two parameters in the following format:
get datafile.pfg mydatafile.pfg
The first part is the name of the file to get from the source machine. The second is the name
that will be given to the file when it is saved on the local machine. Wildcard characters are
allowed, but the first parameter cannot match more than one file on the source machine or
an error will be generated.
Press Enter to go to the next line.
Type bye, which tells FTP to disconnect from the remote machine and exit FTP.
Finally,
save the FTP instruction file with the name that you gave it in the
original batch file (PGGftp.txt in the above example). Be sure that the
original batch file is either located in the same directory as this
file, or have the original batch file list the complete path to the FTP
instruction file in its call to the FTP program.
The instructions above illustrate how to execute a FTP file "pull" running on the client machine
using a set of batch files. It is also possible to execute a file "push" where the server runs the
batch files and sends the data to the client machine. The client machine must have an FTP server
for this to work, however.
Scheduling for the Batch Files
This section will cover scheduling of the automation batch file(s) under Windows NT/2000.
Scheduling is also possible using the Task Scheduler present in Windows 95 Plus! Pack and
Windows 98, but it will not be covered in this document.
Windows NT Scheduling
Scheduling is handled by the Scheduler service in Windows NT. For any scheduled task to
execute, this service must be running.
Verifying Services
To verify that the service is running and configured correctly, take the following steps:
Open the Control Panel under Start/Settings.
Double-click on the Services icon to open its dialog window.
Scroll down to the Schedule service in the list view window of the dialog.
If the service is stopped, click on the service to highlight it and then click on the Start button.
If
the service is not set to start automatically (it may be set at manual
or disabled), click on the service to highlight it and click on the Startup… button. A dialog will pop up containing the startup settings of the dialog.
Select a startup type of Automatic.
Click on the OK button to close the service properties dialog.
Close the Services dialog.
|
NOTE The user must have administrator rights on the machine to perform changes to the services settings in Windows NT.
|
Scheduling Tasks
The following steps may be used to schedule a task in Windows NT:
Open a command line window under Start/Programs/Command Prompt.
Type in the desired task in the format below:
at <time> /every:<day of the week> <command>
The time should be in an hh:mm format.
The day of the week should be as follows:
M - Monday
Tu - Tuesday
W - Wednesday
Th - Thursday
F - Friday
Sa - Saturday
Su - Sunday
Multiple days of the week can be specified by using commas (i.e. M,Tu,W).
The command field should contain the full name and path of the file to be scheduled.
For a Windows dialog-based way to schedule a task in Windows NT, the WinAT program
contained in the Windows NT Resource Kit may be used. WinAT also allows the editing and
removal of individual commands from the scheduler, where as the AT command does not. For
more information on the WinAT program, see the Windows NT Resource Kit documentation.
To delete all currently scheduled tasks, type at /delete at the command prompt.
Windows 2000 Scheduling
Scheduling is handled by the Task Scheduler service in Windows 2000. For any scheduled task to
execute, this service must be running.
Verifying Services
To verify that the service is running and configured correctly, take the following steps:
Open the Control Panel under Start/Settings.
Open the Administrative Tools window by double- clicking on its icon.
Open the Computer Management dialog by double-clicking on its icon.
Double-click on the Services and Applications entry in the left pane of the dialog window to expand the selection and show the entries under it.
Click on the Services entry in the left pane of the dialog window to load the services list into the right pane of the dialog window.
Scroll down to look at the Task Scheduler service listed in the right pane of the dialog window.
If the service is stopped, single-click on the service to highlight it and then click on the Start item in the Action pull-down menu.
If
the service is not set to start automatically (it may be set at manual
or disabled), single- click on the service to highlight it and click on Properties in the Action pull-down menu.
A dialog will pop up containing the settings for the service.
The dialog should start off in the General tab. If it does not, click on General to view its options.
In the General tab, pull down the Startup type list box and select Automatic.
Click on OK to close the dialog.
Close the Computer Management window when the service has been properly configured.
|
NOTE The user must have administrator rights on the machine to perform changes to the services settings in Windows 2000.
|
Now the machine is ready to execute scheduled tasks.
Scheduling Tasks
The following steps may be used to schedule a task in Windows 2000:
Open the Control Panel under Start/Settings.
Open the Scheduled Tasks window by double clicking on its icon.
Double-click on Add Scheduled Task to start the wizard for adding new tasks to the scheduler. The wizard dialog will pop up.
In the wizard, click on Next
after you have read the first page containing an introduction. The
second page of the wizard will pop up and ask for the task that is to be
scheduled.
To schedule a batch file (like those used for Performance Gallery Gold automation), click on Browse to pop up the Select Program To Schedule dialog.
Browse the file system to select the desired file in the Select Program to Schedule dialog.
Once the file has been selected, click on Open to finish selecting the file.
Now
select how often the file should be executed using the wizard. Do not
be concerned that this page only offers day, week, and month options for
its settings. The next dialog will ask for specific information like
which days of the week, at what times, and so on.
Click on Next to go to the page of the wizard.
Select the specific days and times for the task to be run.
Click on Next to go to the login page of the wizard.
The login page of the wizard will ask for a login and password for the scheduled command to
use. This is for security purposes and to allow automated tasks to run as a different user that
may be monitored and audited without being confused with a user or other process.
Typically, however, the current user's login and password are used.
Click on Next
to go to the confirmation page.Now the final dialog will pop up. It
confirms the basic information of the task that is about to be
scheduled.
Click on Finish if the information is correct or use the Back button to correct it or the Cancel button to exit without scheduling the task.
Automation Commands
Under automation, Performance Gallery Gold will first evaluate the entire command line, then
begin loading the given data file (if any). Next, it will set the various non-file related options, load
the specified desktop or default desktop (if any), and attempt to output all chart windows to disk
using the chart’s template name for the file name. Graphs will be stored as .jpg, and tables will be
stored as .htm files. If the batch command has been issued, the program will then exit.
The automation commands for Performance Gallery Gold (PGG) are issued via the command line
upon program execution. The following commands are currently available:
<data file>
List all the data files you want loaded. Up to 20 data files may be specified. If multiple
files are specified, there must be a space between the filenames. The data file
parameter must be enclosed in quotation marks if it contains any spaces or special
characters other than the colon and reverse slash.
|
NOTE Any of the following parameters following the program executable name may contain a path and file name. If
a path and file name is specified, then it must be enclosed by
quotation marks if it contains any spaces or special characters other
than the reverse slash!
|
Parameter
|
Description
|
-batch
|
This option tells the program to exit after the automation command completes.
|
-d:<desktop file>
|
This
parameter specifies the desktop file for PGG to use upon start up. If
no desktop file is specified and data file(s) have been listed in the
automation command, PGG will load the default desktop. If no desktop
file is specified and no default desktop has been selected, no charts
will be exported by the automation command.
|
-e:<export directory>
|
This
item specifies the directory to output the exported charts to. This
directory must exist and the current user must have write privileges to
it.
|
-h:<heading>
|
This
item specifies a setting for the global heading that is displayed at
the top of all graphs. The heading parameter must be enclosed in
quotation marks if the heading contains any spaces or other
non-alphanumeric characters.
|
-notoverlap
|
This item directs PGG to load multiple data files with the non-overlapping option on (see "New Data Overwrites Old").
|
-overlap
|
This item directs PGG to load multiple data files with the non-overlapping option off (see "New Data Overwrites Old").
|
-r:<export resolution>
|
This item sets the graph export resolution in x and y pixel values. For example:
-r:640x480
The separator between the two pixel values should be a lower-case x.
|
-x:<X axis resolution>
|
This item sets the Global Chart Options x axis resolution item using these possible values:
-x:sample
-x:hour
-x:day
|
Example Automation Settings
Example 1:
"C:\Program Files\Lund Performance Solutions\Performance Gallery
Gold\perf.exe" data1.pfg data2.pfg -notoverlap -d:"c:\temp\auto.dsk" -batch
-r:640x480 -e:"C:\Temporary Files"
The above command runs the copy of Performance Gallery Gold (perf.exe) that is present in the
C:\Program Files\Lund Performance Solutions\Performance Gallery Gold folder.
The command directs PGG to load two data files, data1.pfg and data2.pfg, that are contained in
the same directory as the one that the command is run in.The data file names are not enclosed in
quotation marks, as they do not contain any spaces or special characters other than the colon
and reverse slash.
Then the -notoverlap command tells PGG to not allow any overlapping times between files; so
any data in the data2.pfg file that contains overlapping information will have its data used for the
overlapping time period (files are listed in the order that they will be loaded into memory).
Then the -d command tells PGG to load a desktop file called auto.dsk located in the C:\temp
directory. The desktop file name is enclosed in quotes.
Next, the -batch command tells PGG to exit after completing the automation commands.
After that, the -r command specifies that the chart images exported to disk will be 640 by 480
pixels in dimension.
Finally, the -e command specifies that the image files that are generated by the automation
process will be placed in the C:\temporary files directory. The directory path is enclosed in
quotation marks since the path contains a space.
Example 2:
perf.exe sample1.pfg -d:test.dsk -batch -r:800x600 -e:".\output"
The above command runs a copy of Performance Gallery Gold (perf.exe) that is either in the
same directory as the one that the command line is run in, or is in the system path (see the
Windows OS documentation for details).
The command then directs PGG to load the sample1.pfg data file contained in the same
directory as the one that the command is run in.
Then the -d command directs PGG to load the desktop file called test.dsk. The desktop file is
located in the same directory as the one the command line is run in. The desktop file name in not
enclosed in quotation marks, as it does not contain any spaces or special characters other than
the reverse slash. There is no path listed as it is located within the same directory as the one the
command line is run in.
After that, the -r command specifies that the exported chart images will be 800 by 600 pixels in
dimension.
Finally, the -e command specifies that the image and text files that are generated by the
automation process will be placed in to an example folder titled "output." The directory path is
enclosed in quotation marks because the path contains a special character other than the reverse
slash.