Keystroke Files - an Introduction
Maggie Dunbar
BMC Software
Waltham, MA
3 March, 1999
1
Table of Contents
Keystroke Files
Keystroke file basics
Creating a template for use with a keystroke file:
Using Date Variables in templates:
Creating a script for use with a keystroke file:
Publishing graphs to the web from a template, using a keystroke file
Export vs. Web Publish
Sample keystroke file to EXPORT graphs from a template:
Sample keystroke file to WEB PUBLISH graphs from a template:
Renaming a Web Project
Renaming the pages of a Web Project:
Modifying the page titles for a Web Project:
Appendix A
Appendix B
Appendix C
WEBPUBLISHINGWIZARD
Setting up Microsoft Web Publishing Wizard Version 1.1 on Windows 95 or NT 4.0......
Setting up Microsoft Web Publishing Wizard Version 1.5 on Windows 95 or NT 4.0.
Controlling the size of Visualizer-created jpeg files
Enlarging a web page using PERGRAPH.HTT
Appendix D......
Updates to Visualizer keystroke files for Version 3.4.01
Visualizer keystroke command additions for MS Exchange
Date qualification for WebPost or Export file names
Restoring color schemes and name-to-color mappings
Selecting graph objects by parameter
1
Keystroke Files
Keystroke file basics
The primary purpose of the keystroke file in Visualizer is to automate output from an Automator Graphics/Costing event. Usually this would mean printing or Web Publishing a series of graphs, but it can be as simple as creating a project file and as complex as copying data values to a spreadsheet. A keystroke file navigates through the Visualizer menu system by using the letters that are underlined in the menus, starting with the Main Menu bar. For example, the keystroke command %fpp designates File/Print/Project: File from the Main Menu, Print from the drop-down menu, Project from the Print menu. There is also a set of macros for common tasks. For example, {FilePrintProject} is the macro for %fpp. A keystroke file must identify a database and a template containing the graphs to be created when the script is run.
A default keystroke file, AUTO.KEY, is created each time a graphics/costing event is run, and is stored in the default /TEMP directory. The default AUTO.KEY may be edited and saved under a new name for use in a Graphics/Costing event in Automator.
Creating a template for use with a keystroke file:
In order to use a keystroke file, a Visualizer template must exist that builds a set of graphs. This section describes how to build a template.
1) Invoke Visualizer.
2) Focus on a database.
3) Set the proper values in Data Selection.
4) Draw the graph(s).
5) Click on WINDOWS/PAGE LAYOUT and select an appropriate choice.
6) Click on WINDOWS/CLOSE WINDOWS.
7) Click on WINDOWS/PAGE SELECT/ALL PAGES.
8) Click on FILE/SAVE TEMPLATE AS and give the template a NEW, UNIQUE name.
In Automator, run a GRAPHICS/COSTING event, specifying this new template name in the USE TEMPLATE FILE box.
Using Date Variables in templates:
In many cases when you define and use a template, you want to draw the same set of graphics for different dates. This section describes how to define variable dates.
1. Select a data source.
2. From the Database menu, choose Detail...to access the Data
Selection dialog box.
To specify a variable date go to Step 3.
To define the template so that the system asks you to choose a date each time you open the template, go to Step 5. This is useful if you need to generate graphics for a time that cannot be defined by a variable (e.g. 2 weeks ago, 3 months ago).
To specify variable times, go to Step 7.
3. Enter one of the following in Date.
Note: The following date variables are relative to either the FIRST or LAST day in the database. They reference groups of dates and are for use only in the Date field.
<ALL> All dates.
<FIRSTnDAYS>The first n number of days.
<LASTnDAYS>The last n number of days.
<LASTMONTH>The last (previous to current) month.
<LASTWEEK>The last week, starting with Saturday and counting
back 7 days from there. This only works for data
collected 7 days a week.
<LASTWKDAYS>The last work week, starting with Friday and
counting back to Monday. The group includes a
minimum of 1 day, and a maximum of 5 days.
<MONTH> The current month, beginning from the last month in
the data source.
<WKDAYS>The current week, beginning with the Monday and
including every day up to and including Friday.
<WEEK> The current week, beginning with the most recent
Sunday.
The following variables reference individual dates (or individual objects):
<FIRST> The first date.
<NEXT> The second date (<FIRST> + 1).
<NEXTn> The next relative to first. For example:
<NEXT0>=<FIRST>
<NEXT1>=<NEXT>
<NEXT2>=<NEXT> + 1
<NEXTLAST>The next to the last date (<LAST> - 1).
<NEXTLASTn>The next to the last date relative to <LAST>. For
example:
<NEXTLAST0>=<LAST>
<NEXTLAST1>=<NEXTLAST>
<NEXTLAST2>=<NEXTLAST> + 1
<LAST> The last date.
<LASTDAYn>The last day with n intervals.
4. Choose OK, and go to Step 10.
5. Highlight the Date, define a group of one or more dates, and select
the group.
It does not matter which dates you put into the group. The only purpose of this is to ensure that when you open a template, BEST/1-Visualizer accesses the Data Selection dialog box for you to choose data before drawing template graphics.
6. Click OK, and go to Step 10.
7. Enter one of the following in Start Time.
<FIRST> Use the first time interval.
<NEXT> Use the second time interval (next to first).
8. Enter one of the following in End Time.
<LAST> Use the last time interval.
<NEXTLAST>Use the next to the last time interval.
<LASTSAME>Use the last time interval for the Date specified.
9. Click OK, and go to Step 10.
10. Draw all of the graphics you want to include in the template,
and place them on pages if you wish. When you open a template, the
graphic will be wherever it was when you saved the template, whether
on a page or on the main window.
Creating a script for use with a keystroke file:
In order to execute a keystroke file, an Automator script must exist that invokes a template to build a set of graphs. This section describes how to create an Automator script for a keystroke file.
1) Invoke Automator
2) Select File/New.
3) Select a Target Database Group. The database you select is moot if you are going to override it in the keystroke file.
3) Select Edit/Add Event/Graphics-Costing.
4) Click the radio button that says 'Use keystroke file' and enter the name of the keystroke file in the box.
5) Click on OK.
6) Select File/Save As and give the script a NEW, UNIQUE name.
Publishing graphs to the web from a template, using a keystroke file
Export vs. Web Publish
The primary difference between the Export and Web Publish functions is that Export allows you to specify a variety of output file formats for use in other PC applications. Web Publish, on the other hand, is meant solely for automatic Internet/Intranet publishing.
There is a minimum Windows NT Service Pack level requirement to support the graphics conversion (OCX/OLE) functionality contained within the Web Publish and File Export functions. These minimum requirements for Windows NT are:
Windows/NT 3.51 Service Pack 5
Windows/NT 4.0 Service Pack 2
If the minimum Service Pack level does not exist, then the Installation/Setup program will issue a message about not being able to self-register the file "LTOCX70N.OCX". If you do not intend to export graphics, this message is harmless.
The Web Publish function will run ONLY under Windows NT 4.0 or Windows 95. The File Export function will also run on Windows NT 3.5.
The Web Publish function requires (invokes) Microsoft's Web Publishing Wizard, which can be obtained through Microsoft's Web site ( by
doing a search for "webpost".
To automate the export/publication of graphs to the web, you can use the Automator Graphics/Costing event (if you're running Windows 95 and Microsoft's WEB PUBLISHING WIZARD Version 1.1; with version 1.5 or later of the WEB PUBLISHING WIZARD, either Windows 95 or Windows NT 4.0 is supported.) The output file name specified in the Graphics/Costing Panel must match the name supplied on the second WEB PUBLISHING WIZARD panel, titled NAME THE WEB SERVER (where it is stated 'Use this name when you publish files to this Web server'). If you are using Visualizer 3.2c and version 1.5 or later of the WEB PUBLISHING WIZARD, you must supply not only the file name referred to above, but additionally the fully qualified URL entered on the third WEB PUBLISHING WIZARD panel, titled SPECIFY THE URL AND DIRECTORY (where it is stated 'URL or Internet address'). Visualizer version 3.3 and later do nto require the fully qualified URL.
If you are running Windows NT 4.0 and WEB PUBLISHING WIZARD 1.1, you must not only supply the web site name, but also the userid and password in the keystroke file (due to security built into Window NT 4.0). (See example "Sample Keystroke file to WEB PUBLISH graphs from a template). If you are running Windows NT 4.0 and WEB PUBLISHING WIZARD 1.5 or later, specification of the userid and password are not required.
Sample keystroke file to EXPORT graphs from a template:
{} Start with system defaults{Defaults}
{} Turn Confirmation off
{OptionsConfirmNone}
{} Identify database to use
{OverrideDATA} c:\temp\cantire\pop3data
{} Identify template to use
{FileNewFrom} c:\temp\cantire\dailycta.bvt
{} Wait 5 seconds
{Wait} 5
{} Close window
{noPend} %wo
{} Wait 5 seconds
{Wait} 5
{} Identify export location
{FileExport} d:\temp\can.wmf
{} Wait 5 seconds
{Wait} 5
{} Exit keystroke file
{HardExit}:
Sample keystroke file to WEB PUBLISH graphs from a template:
('myweb' must match the name supplied on the first WEB PUBLISHING WIZARD panel (where it is stated 'Use this name instead of its Internet address or URL (Uniform Resource Locator) when you publish your Web pages to this Web server'); 'userid' and 'password' must match those values supplied in the WEB PUBLISHING WIZARD (on the panel where it is stated 'Type the user name and password for your Web server account').
{Defaults}{} Turn off Options/Confirmations
{OptionsConfirmNone}
<--- turns OPTIONS/CONFIRMATIONS off
{} Identify database to use
{OverrideDATA} c:\temp\cantire\pop3data
<--- pts to d/b to use
{} Identify template to use
{FileNewFrom} c:\temp\cantire\dailycta.bvt
<--- pts to template
{} Wait 5 seconds
{Wait} 5
<--- waits 5 seconds
{} Close window
{noPend} %wo
<--- closes windows
{} Wait 5 seconds
{Wait} 5
<--- waits 5 seconds
%fwmyweb{ENTER} <--- file/webpost (myweb is website 'use this name'
{Wait} 2 <--- waits 2 seconds
%uuserid%ppassword <--- userid = 'User Name',password = 'Password'
{Wait} 1 <--- wait 1 second
{TAB}{ENTER}{ENTER} <--- tab to 'OK' and ENTER
{Wait} 12 <--- waits 12 seconds; depends on # of graphs, network speed
{ENTER} <--- ENTER
{Wait} 5 <--- waits 5 seconds
{HardExit}: <--- exits keystroke file
Renaming a Web Project
By default, the project on the web takes on the name of the Visualizer template/project. If a different name is desired, the following procedure must be followed:
1. After creating the template in Visualizer, (but before clicking on
FILE/SAVE TEMPLATE AS) click on WINDOWS/CLOSE WINDOWS.
2. Click on EDIT/TITLE/SUBTITLE/COLORS; the GRAPH OPTIONS panel will be
displayed.
3. Enter the desired TITLE and click <OK>.
4. Click on WINDOWS/PAGE SELECT/ALL PAGES.
5. Click on FILE/SAVE TEMPLATE AS and give the template some NEW, UNIQUE
name.
Renaming the pages of a Web Project:
By default, the pages on the web takes on the name of PAGE 1, PAGE 2, etc.. If different names are desired, one of the following procedures must be followed:
1. After creating the template in Visualizer, (but before clicking on
FILE/SAVE TEMPLATE AS) click on WINDOWS/CLOSE WINDOWS.
2. Click on WINDOWS/PAGE SELECT/ALL PAGES.
3. Focus on/select the first page.
4. Click on EDIT/TITLE/SUBTITLE/COLORS; the GRAPH OPTIONS panel will be
displayed.
5. Enter the desired TITLE and click <OK>.
6. Repeat steps #3 - #5 for each page.
7. Click on WINDOWS/CLOSE WINDOWS.
8. Click on WINDOWS/PAGE SELECT/ALL PAGES.
5. Click on FILE/SAVE TEMPLATE AS and give the template some NEW, UNIQUE
name.
Modifying the page titles for a Web Project:
To modify the title of the page to use something other than the default, perform the following:
1. In the Visualizer install directory, find PROJECT1.HTT; PNum places the page number on the upper left side of the graphics page.
PROJECT1.HTT<body>
<SCRIPT LANGUAGE="JavaScript">
GraphCount = <Visual/nGpP>
</SCRIPT>
<base target="main">
<center>
<h2<Visual/Head</h2>
<hr width=40%>
<font size=-1<Visual/Note>
<hr width=40%>
Page <Br>
<a href="<Visual/ByPg>"<Visual/PNum</a>
<br>
<hr width=55%>
Graphics produced by BEST/1 Visualizer.
<P® BMC and BEST/1 are registered trademarks of BMC Software.
</center>
</body>
2. Then find BYPAGE.HTT; PHdr places the Page Header on the upper right side of the graphics page.
BYPAGE.HTT<body>
<SCRIPT LANGUAGE="JavaScript">
GraphCount = <Visual/nGpP>
</SCRIPT>
<CENTER<H3<Visual/PHdr</h3</center>
<CENTER<Table Border=2 width=100% height=100%>
<tr<Visual/Graph>
</tr</table>
</center>
</body>
1
Appendix A
{OptionsConfirmNone} - Replaces %on%d%g{TAB}{ENTER} generated by Automator.
{HardExit} - Replaces %fx generated by Automator.
{Address} command - Executes the command file indicated.
{Wait} n - Waits the specified number of seconds. Used to give an event time to complete before executing the next command.
{FileNewFrom} Template_file_name - Replaces {noPend}%fnfTemplate_file_name{Enter} generated by Automator and waits for the template to complete {no/Pend/Wait/etc.}.
{FileOpen} Project_File_Name. - Opens Project_File_Name. The project must already exist.
{FileExport} WMF_File_Name (including the extension): - Exports the selected graph or page to WMF_File_Name. Specify a full path with WMF_File_Name to save to a directory other than the current directory.
{FileExportProject} WMF_File_Name (including the extension): - Exports the entire Project to WMF_File_Name. Specify a full path with WMF_File_Name to save to a directory other than the current
directory.
{File Print} - Prints the selected graph or page to the (unmodified) DEFAULT PRINTER. If the default printer is set to print to a file, this process will "hang".
{FilePrintScreen} - Prints an image of the screen to the (unmodified) DEFAULT PRINTER. If the default printer is set to print to a file, this process will "hang".
{FilePrintProject} - Prints the graphs/pages of the entire project to the (unmodified) DEFAULT PRINTER. If the default printer is set to print to a file, this process will "hang". This command replaces %fpp{ENTER} generated by Automator.
{OverrideDATA} DB_pathname: - Defines the DB directory for a template WHETHER OR NOT the original directory exists. This replaces {SetDATA} for the "generic template" option of Automator.
{FileTemplate} Template_File_Name: Saves the current project to Template_File_Name. Specify a full path with Template_File_Name to save to a directory other than the current directory.
{FileSaveAs} Project_File_Name: - Saves the current project under a new name. Specify a full path with Project_File_Name to save to a directory other than the current directory.
{Comment} - Starts a comment block.
{End} - Ends a comment block.
{} - provides a one-line-only comment, can be used to block execution of a line of
the keystroke file.
{noPend} rest of line - Executes the next command, bypassing the keystrokes passed by {noPend} for processing. This is necessary for feeding menu keys, since menu processing is not complete until an action has been selected and completed. The "rest of the line" begins with the first non-blank character. Executions {Waits} after passing each line to the window.
{Pend} - Detects when the {noPend process is complete.
{MouseTo} x,y - places the mouse cursor at the specified x,y coordinates. X and Y are relative to the size (0-1) of the full rectangle.
{MouseIn} x,y - places the mouse cursor at the specified x,y coordinates. X and Y are relative to the size (0-1) of the client (excludes title bar and menu) rectangle.
Appendix B
Example 1: Example of changing the page layout from the printer options screen.
{}Windows/Page Layout/2x2%wl2{ENTER}
Example 2: Example of opening and closing a template/project.
{Defaults}{OptionsConfirmNone}
{OverrideDATA} d:\best131p\db\mvs
{FileNewFrom} d:\temp\pgdwn2.bvt
{Wait} 15
{FileSaveAs} d:\temp\pgdwn.vis
{HardExit}
Example 3: Example of printing graphs to a file.
{}Reset to system defaults{Defaults}
{}Set Confirmation Options Off
{OptionsConfirmNone}
{}Specify target database
{OverrideDATA} c:\b1vis330\db\i111_284
{}Specify template name
{FileNewFrom}c:\b1vis33\input\test.bvt
{}Request print output to the named file in landscape format
%fp%l{ENTER}c:\b1vis330\input\test.ps{ENTER}{ENTER}
{}Wait for print to finish
{Wait} 5
{}Save template as test.
{FileSaveAs}test
{}Exit
{HardExit}
Example 4: Example of paging down on a graph.
1. If a template is created such that the graph is put onto a page -
(windows/page layout/one per page, windows/close windows, windows/page select/all pages) as is the recommended practice - then there is currently no method to 'page down' on a graph. The problem is that you'd need to 'double-click' within the graph to re-establish connection to the database and provide the scroll bar. There are no known keystrokes to provide this 'double-click'.
2. If the template is created WITHOUT saving the graph to a page, then moving down in a graph is possible. You'll need to verify that you're focused on the correct graph (if there's more than one in the template). You can move from one graph to the next within the keystroke file by coding ^{TAB} (this is equivalent to Control Tab). Once you're focused on the correct graph, you can page up or down a line at a time by coding {UP} or {DOWN} or a page at a time by coding {PGUP} or {PGDN}.