Topcount Tandem Processing Using Automated Spreadsheets
Total Page:16
File Type:pdf, Size:1020Kb
TCA-006 TopCount Tandem Processing Using Automated Spreadsheets Abstract Both Lotus 1-2-3 and Quattro Pro provide a record mode for easy writing of macros. In this An example of automating the use of Lotus® 1-2- mode, each key stroke is recorded and saved to 3 and Quattro Pro® spreadsheets with the Top- create the macro. The user should refer to the Count® Microplate Scintillation Counter is pre- appropriate software reference manual for greater sented. A simple batch file is used to control the detail. overall execution of the process. It copies the data file to the appropriate directory, archives the data, The following paragraphs contain examples of calls the spreadsheet program, and returns control two auto-executing macros (a macro that runs to the TopCount system. The spreadsheet con- automatically when the spreadsheet is called) and tains an auto-executing macro which imports the the batch files required to run Lotus 1-2-3 and data, performs the calculations, and prints the Quattro Pro as on-line application programs with spreadsheet. There are many applications, in- TopCount. The macros presented here function cluding the use of worklists, for this automated identically, and serve as examples of how to method. By automating the data reduction pro- automate two popular spreadsheet programs. cess, considerable time can be saved to calculate Although these examples are simple, more so- final answers, and data handling errors are elimi- phisticated data management and calculation rou- nated. tines are possible using the batch files and macros given here, and modifying them as desired. As Introduction presented, the macro copies the data into the appropriate cells of the spreadsheet, and prints the The tandem processing feature of TopCount spreadsheet which contains a simple worklist. provides a path to DOS and allows for unat- tended data management and storage. The data Program and System Description can then be automatically processed with addi- tional application software to final answers. With The Lotus 1-2-3 spreadsheet macro. tandem processing, popular spreadsheet programs The following macro was written starting like Lotus 1-2-3 or Quattro Pro can be used to in cell A1 of a new spreadsheet. The spreadsheet automatically process stored data by importing was then named TCMAC.WK1 (see Figure 1). the data into a spreadsheet that contains a macro. A macro is a sequence of recorded keystrokes or The macro is named \Ø. It will execute automati- commands that the spreadsheet program executes cally when TCMAC.WK1 is called. Lines 4-9 of automatically. When a macro is executed, the the macro can be changed according to need. sequence of instructions will be performed. A Rep1, rep2, and rep3, referred to in the macro, are macro can be thought of as a program that can be names given to a range of cells. The names are run within the spreadsheet. Through the use of used as cell addresses to receive the data. auto-executing macros, the user can automate the TCMAC.WK1 is stored in the LOTUS spreadsheet to perform specific data processing subdirectory. Besides the macro, it contains a routines whenever a spreadsheet is loaded. The template (cells defined with labels and formulas only requirement is that the user is familiar with to receive the data manipulated by the macro). In the spreadsheet program and writing macros. this case, the template is a simple worklist; see PAN0008 11/91 Printed in U.S.A. © 1991 Packard Instrument CompanyPackard Instrument Company One State Street, Meriden, CT 06450 Tel. 1-800-323-1891 203-238-2351 TX: 643251 FAX: 203-235-1347 Explanation and line numbers are NOT part of macro. 1. {home} ...move the cursor to home position 2. {r}{r}{r}{r} ...move 4 places right 3. /finappl.dat~ ...import data file appl.dat 4. goto}f1~ ...go to cell f1 5. /cf25..f36~rep1~ ...copy from cells f25 to f36 to cell 6. /cf49..f60~rep2~ named rep1;repeat copy for cells 7. /cf73..f84~rep3~ to rep2 and 3. 8. {goto}g1~ ...go to cell g1 9. /pprg1..p16~ ...print cells g1 to p16 10. agpg ...align the paper and print 11. /qyy ...quit the spreadsheet Figure 1. Macro, named \Ø, contained in TCMAC.WK1. Figure 5. After proper placement of the template containing the macro and template to in the spreadsheet, the data will be placed in the AUTO123.WK1 (this file will automatically load correct locations by the macro. A word of caution when Lotus 1-2-3 is run). Line 11 executes Lotus is in order about positioning the template. In the 1-2-3. Line 12 renames the AUTO123 file to the event the data file is large, the template should be original spreadsheet name. Line 13 erases the adequately removed from the cells that will con- APPL.DAT file. tain the imported data to avoid overwriting the cells of the template. The batch file contains replaceable parameters indicated by the symbols, %1 and %2. When the A. The Batch File for Lotus 1-2-3. batch file is run, the %1 and %2 symbols will be Before writing the batch file, two subdirectories replaced by file names passed to the batch file by were created. TCMACRO off the root directory, TopCount. The filenames are entered in the c:\; and ARCHIVE off the LOTUS (c:\LOTUS) Command String line in the Select Application directory. window of TopCount. This will be explained in the following paragraphs. A batch file named AUTO123.BAT copies the appropriate data files, stores the data in the B. TopCount Setup for Lotus 1-2-3 macro. ARCHIVE directory, and calls the spreadsheet. It is placed in the TCMACRO subdirectory. It can be created with any ASCII editor like EZ or EDLIN1. Line numbers are NOT part of the batch file. 1. @echo off The batch file, AUTO123.BAT, consists of the 2. If not exist c:\LOTUS\*.* goto end statements in Figure 2. 3. If not exist c:\TCMACRO\%1 goto end 4. :start What does the batch file do? Lines 2 and 3 check 5. copy c:\TCMACRO\%1 c:\LOTUS>nul to see if the appropriate paths exist and if there are 6. erase c:\TCMACRO\%1 files in them. Line 5 copies the TopCount data file 7. cd\LOTUS to the LOTUS directory for processing. Line 6 erases the data file from the TCMACRO direc- 8. copy %1 c:\LOTUS\ARCHIVE tory. Line 7 changes to the LOTUS directory. 9. copy %1 APPL.DAT Line 8 copies the TopCount data file to the 10. rename %2 AUTO123.WK1 ARCHIVE subdirectory of LOTUS for perma- 11. 123 nent storage. Line 9 copies the data file to 12. rename AUTO123.WK1 %2 APPL.DAT - the file name indicated in the 13. erase APPL.DAT macro. Line 10 renames the spreadsheet file 14. :end Figure 2. 1 EZ Editor is supplied with the instrument software and is Statements for AUTO123.BAT Batch File. located in the TopCount subdirectory. 2 The following information was entered in the Disk File Output window: Line numbers are NOT part of the batch file. Question Answer 1. {home} Data File Name? 123lin.001 (in this example) 2. {right 4} Drive and Path? c:\TCMACRO 3. {/file;ImportNumbers} Count Data? (View/Edit used to define the 4. {clear} cells; in this example only sample 5. c:\qpro\appl.dat~ number and CPMA were 6. {meta 312} 7. {esc} chosen) 8. {goto}f1~ Data Line? Sample 9. {/block;copy}f25..f36~ Data Column Header? No 10. rep1~ TopCount can store the data in an importable file 11. {/block;copy}f49..f60~ format in either a linear (LIN123) or matrix 12. rep2~ (MAT123) array for importing into either Lotus 13. {/block;copy}f73..f84~ or Quattro spreadsheets. The LIN123 data array 14. rep3~ was chosen here. 15. {goto}h1~ 16. {/print;resetblock} The following information was entered in the 17. {/print;block}h1..r18~ Select Application window: 18. {/print;go} 19. {end} Question Answer 20. {system;exit}y Program Name? AUTO123.BAT Drive and Path? c:\TCMACRO Figure 3. Macro, named \Ø, contained in Command String? 123lin.001 TCMAC.WK1 TCMAC.WQ1. Run application? plate The command string is used to pass the name of The setup for TopCount is the same as described the TopCount data file, and the spreadsheet to be above, except the batch file name is changed to called, to the AUTO123.BAT file. QAUTO.BAT and the spreadsheet is changed to TCMAC.WQ1: NOTE: The command string is limited to 20 characters. If more than one file name is entered, Question Answer the total numbers of characterscan not exceed 20. The Quattro Pro spreadsheet macro. The macro, named \Ø, was written in a spread- Line numbers are NOT part of the batch file. sheet named TCMAC.WQ1 and stored in the 1. @echo off QPRO subdirectory (see Figure 3). It performs the same tasks as the one for Lotus. 2. if not exist c:\QPRO*.* goto end 3. if not exist c:\TCMACRO\%1 goto end Lines 8-17 can be modified and additional 4. :start lines may be added, depending on the data 5. copy c:\TCMACRO\%1 c:\QPRO>nul and processing required. 6. erase c:\TCMACRO\%1 7. cd\QPRO A. The Batch File for Quattro Pro. 8. copy %1 c:\QPRO\ARCHIVE The batch file, named QAUTO.BAT, performs 9. copy %1 APPL.DAT the same functions as the one for Lotus. After 10. q %2 written, it is placed in the TCMACRO subdirectory 11. erase APPL.DAT (see Figure 4). 12.