home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / database / powerbase / docs / scriptfile < prev    next >
Encoding:
Text File  |  1995-08-21  |  7.5 KB  |  160 lines

  1. Ch 12 − Script Files
  2.  
  3. Powerbase incorporates a script language which lets you control some
  4. features from a script file. Using script files you can automate jobs which
  5. need to be done frequently. Print jobs are the most obvious example, and
  6. most of the script commands concern printing.  Script files are plain text
  7. files (created with Edit) and are executed by dragging them to the main
  8. Powerbase window. All commands in a script file must be in upper-case,
  9. preceded by “!”, and may be followed by a parameter, separated from the
  10. command by a single space. The following commands may be used (parameters in
  11. square brackets are optional):− 
  12.  
  13. !SCRIPT All script files must begin with the line !SCRIPT POWERBASE. This
  14. enables the program to distinguish a script from other text files. You
  15. should make !SCRIPT END the last line of the file. The command can be made
  16. to “chain” another script file by following it with the name of the new
  17. file, i.e. by using the form !SCRIPT <filename>. 
  18.  
  19. !COMMENT may be used to insert comments in a script file. The rest of the
  20. line after the command is ignored. 
  21.  
  22. !SELECTION <filename>  where <filename> is the name of a selection file in
  23. the PrintRes directory, installs the selection as if you had dragged it from
  24. PrintRes to the Powerbase window yourself. If you issue the command without
  25. a parameter the current selection will be cleared. 
  26.  
  27. !PRINTOPTS <filename>  where <filename> is the name of a print options file
  28. in the PrintRes directory, sets the print options just as if the the file
  29. had been dragged from PrintRes to the Powerbase window.  Issued without a
  30. parameter causes the default options to be set. 
  31.  
  32. !QUERY [filename,]<search formula>  is used to print a list. It returns the
  33. same result as typing the search formula into the Print window and clicking
  34. Print. If you first issue a !DESTINATION File command you can use a script
  35. containing a list of !QUERY commands to create a batch of reports as text
  36. files in PrintJobs. !CASE and !INDEX also affect the behaviour of this
  37. command if issued beforehand. 
  38.  
  39. !CSV  [filename,]<search formula>  resembles !QUERY but produces a CSV file
  40. in PrintJobs. A !DESTINATION command is, of course, unnecessary.
  41.  
  42. !EXPAND is one of a number of commands used to select or deselect a switch
  43. in the Print options window. !EXPAND ON selects the switch which causes
  44. fields to be expanded by reference to a linked validation table. !EXPAND OFF
  45. (or just !EXPAND by itself) deselects the switch. 
  46.  
  47. !DATE turns date and time stamping ON and OFF. It works in exactly the same
  48. way as !EXPAND. 
  49.  
  50. !UPPER forces upper-case printing when followed by ON, normal upper/lower
  51. case printing otherwise. 
  52.  
  53. !UNDERLINE turns underlining ON and OFF when output is sent to the printer.
  54. Underlining won’t be visible when the report is displayed in a window,  but
  55. will occur when the output is subsequently printed. 
  56.  
  57. !CASE turns the Case specific switch on the Query panel ON and OFF. 
  58.  
  59. !HEADER followed by ON causes header information (see 3.5) to be printed on
  60. reports.
  61.  
  62. !FIRST followed by ON causes the header to appear on the first page only.
  63.  
  64. !FOOTER followed by ON causes footer information (see 3.5) to be printed on
  65. reports.
  66.  
  67. !SHRINK followed by ON this removes surplus “white space” between the
  68. columns of reports in Vertical format. 
  69.  
  70. !HEADINGS D causes descriptors to be used as field identifiers in a report.
  71. !HEADINGS T, or without any parameter, causes tags to be used. 
  72.  
  73. !PITCH <n> sets the number of characters per inch for hard-copy printing to
  74. n, which  should be 5, 10, 12 or 17, representing double-width, pica, elite
  75. and condensed respectively.
  76.  
  77. !TITLE <string> uses <string> as a title on subsequently printed reports. 
  78.  
  79. !PAGE <n> sets the page length for reports to n lines. 70 is correct for A4,
  80. 66 for American letter. 
  81.  
  82. !LINESPACE <n> sets the line-spacing to n lines. The default is 1, i.e. no
  83. blank lines between lines of report. 2 gives double-spacing
  84.  
  85. !LMARGIN <n> sets the left margin to n character spaces. 
  86.  
  87. !TMARGIN <n> sets the top margin to n lines. 
  88.  
  89. !SPACER <string> specifies the string to be used to separate columns of
  90. printed data in reports using Horizontal or Table format. 
  91.  
  92. !COLWIDTH <n> sets the width of the blank columns used in Table format to n
  93. spaces. 
  94.  
  95. !FORMAT <string> where <string> is Horizontal, Vertical, Label or Table
  96. (N.B. case of <string> does not matter), sets the print format. In the last
  97. case the number of columns required must be appended as a second parameter,
  98. e.g. TABLE 8. If any other parameter is used, or !FORMAT is issued by
  99. itself, the Horizontal format is used. 
  100.  
  101. !DESTINATION <string> where <string> is Window, File or Printer (N.B. case
  102. of <string> does not matter), sets the destination for report printing (see
  103. 3.1).  If File is used the report is saved in PrintJobs
  104.  
  105. !LABEL is used to define a label specification to use with the LABEL format.
  106. It requires seven parameters, separated by commas:− 
  107.  
  108. (1)     The number of labels across the page (1,2 or 3)     
  109.  
  110. (2)     The horizontal label pitch (i.e. left edge to left edge) in inches. 
  111. This is only meaningful when  (1) is 2 or 3.     
  112.  
  113. (3)     The vertical label pitch in inches.     
  114.  
  115. (4)     The number of lines to be printed on each label.     
  116.  
  117. (5)     The line which is to be replaced, if blank, by the last field in the
  118. selection. If nothing is entered here (2 commas together) then no
  119. substitution is performed.     
  120.  
  121. (6)     If ON is entered the the primary key will appear on the label (in
  122. brackets) as an identifier.
  123.  
  124. (7)     If ON is entered blank fields will be skipped when printing. 
  125.  
  126. !DELETE <key> deletes the record whose primary key is <key>. The benefits of
  127. this command may not be at all obvious. Suppose you have a text file giving
  128. details of records which must be deleted from the database. If such a job is
  129. going to occur at all often it could be worthwhile to write a customised
  130. program to read the text file and generate the primary key of each record,
  131. then output the results as a Powerbase script file with each key preceded by
  132. !DELETE. The whole batch of records can then be deleted by simply dragging
  133. the script into Powerbase. Not worthwhile for ten records, perhaps, but
  134. could be for a hundred. Note that all 6 subfiles will be searched for the
  135. records to be deleted. 
  136.  
  137. !INSERT is the counterpart of !DELETE and is useful in similar
  138. circumstances. In this case the command must occupy a line by itself and be
  139. followed by the record to insert, one field to a line. It is the user’s
  140. responsibility to ensure that the lines are not too long for the database
  141. fields into which they are placed and that the number of lines following
  142. each !INSERT is the same as the number of fields in the record. Don’t forget
  143. to leave blank lines for empty fields!  Records will be inserted into the
  144. currently-selected subfile
  145.  
  146. !IMPRESSION , used in conjunction with !QUERY to generate a report in
  147. text-file format, allows you to insert Impression DDF* commands at the start
  148. of the text-file. A script may, for example, execute a series of !QUERY
  149. commands and the resulting files are to be all selected together and dragged
  150. into an Impression document. To make each file go into a new frame you need
  151. to make each begin with {nextframe}. This can be achieved by placing the
  152. script command !IMPRESSION {nextframe} before the first !QUERY. You do not,
  153. however, want {nextframe} to begin the first file created, or the Impression
  154. document will have a blank frame on its first page. To suppress the effect
  155. on the first file use the form:− 
  156.  
  157. !IMPRESSION {nextframe} Not first
  158.  
  159. There must be a space between the “}” and the “N”, but the “Not first”
  160. string isn’t case sensitive.