home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d02xx / d0288.lha / Scripit / Examples < prev    next >
Text File  |  1989-12-10  |  7KB  |  236 lines

  1.                         Example Scripit Scripts
  2.                         -----------------------
  3.  
  4.                           By: Khalid Aldoseri
  5.  
  6.  
  7. -----------------------------------------------------------------------------
  8.                                 Example 1
  9. -----------------------------------------------------------------------------
  10.  
  11. This is a script that shows you how to launch any program
  12. and do a set of actions:
  13.  
  14. begin
  15. select wait 1000 abort
  16. runback "full pathname" arg1 arg2 ... argn
  17. select "program's screen name" "program's window name"
  18. menu    MenuName MenuItem [SubItem]
  19. menu    .... etc.
  20.  
  21.  
  22. Example:
  23.  
  24. begin
  25. select  wait 1000 abort
  26. runback "dh2:Access/Access!"
  27. select  screen "Access"
  28. menu    "Phone" "Re-Dial"
  29.  
  30. Notes:
  31.  
  32.     The quotes are not important unless you have spaces or commas
  33.     in the arguments.
  34.  
  35.     If you need to specify any CLI command switches when running
  36.     the program use:  runback programname arg1 arg2 .. argn
  37.  
  38.     With Access, it's best if you wait for all its windows to
  39.     appear on the screen, so you can either add a WAIT statement
  40.     after the SELECT, or you can change the SELECT to become
  41.     a  (SELECT Access ^4)  This tell Scripit to wait until four
  42.     windows show up on the Access screen.
  43.  
  44. -----------------------------------------------------------------------------
  45.                                 Example 2
  46. -----------------------------------------------------------------------------
  47.  
  48. This is an expanded example of Example 1:
  49.  
  50. begin
  51. select wait 1000 abort
  52. runback "dh2:Access/Access!_Supra"
  53. select Access ^5
  54. menu Phone Re-Dial
  55. runback "dh2:Access/ShowModem -sAccess"
  56. select Access "Supra Modem"
  57. window moveto 640 0
  58.  
  59. The following is a full description of it:
  60. (all lines starting with ;; are comments and are ignored by Scripit.)
  61.  
  62. ;; This Scripit script will load Access, tell it to start dialling
  63. ;; then run the Supra ShowModem program and move its window to
  64. ;; the top left corner of the screen.
  65. ;;
  66. ;; By: Khalid Aldoseri.
  67. ;;
  68. ;; Begin script
  69. begin
  70. ;; Set 'select' wait time to 1000 jiffies (20 seconds) with abort mode on.
  71. ;; Note: I set the abort mode on because the script would be useless if
  72. ;; the Access window didn't show up at all.
  73. select wait 1000 abort
  74. ;; Run Access
  75. ;; Replace this with the full path of where your copy of Access is.
  76. runback "dh2:Access/Access!_Supra"
  77. ;; Wait until all of Access's five windows show up.
  78. ;; Note:  If you're not using the chat window change the
  79. ;; ^5 to ^4.
  80. select Access ^5
  81. ;; Tell Access to Re-Dial.  i.e. dial first number in list.
  82. menu Phone Re-Dial
  83. ;; Run the Supra ShowModem program.
  84. ;; Replace this with the full path of where your ShowModem is.
  85. runback "dh2:Access/ShowModem -sAccess"
  86. ;; Wait until ShowModem's window shows up.
  87. waitfor Access "Supra Modem"
  88. ;; Move it to the top right corner of the screen.
  89. window moveto 640 0
  90. ;; Note:  Remove the lines with ;; if you don't want them.
  91.  
  92. -----------------------------------------------------------------------------
  93.                                 Example 3
  94. -----------------------------------------------------------------------------
  95.  
  96. This is a small script that expands the current CLI window, moves the cursor
  97. to the top, and then clears the whole window including its borders. This
  98. gives you a blank CLI with no borders.
  99.  
  100. begin
  101. select active
  102. window moveto 0,0
  103. wait 10
  104. window maxsize
  105. wait 10
  106. con move 0,0
  107. gfx clear 0,0
  108.  
  109.  
  110. Here it is again with comments:
  111.  
  112. begin
  113. ;; Select the active CLI.. normally the one it was started from
  114. select active
  115. ;; Move that window to the top left corner of the screen
  116. window moveto 0,0
  117. ;; Wait a while to make sure the window move operation is done
  118. wait 10
  119. ;; Resize the window to the maximum size possible
  120. window maxsize
  121. ;; Wait a while to make sure the window resize operation is done
  122. wait 10
  123. ;; Move the console cursor to the top
  124. con move 0,0
  125. ;; Clear the window's text/graphics starting from 0,0
  126. gfx clear 0,0
  127.  
  128. -----------------------------------------------------------------------------
  129.                                 Example 4
  130. -----------------------------------------------------------------------------
  131.  
  132. Here's one the runs WordPerfect, resizes its window to fit half the screen,
  133. tells WP to open a new window, resizes that to half as well and moves it to
  134. the bottom of the screen, giving you WP ready for action with 2 windows
  135. ready. (grin)
  136.  
  137. begin
  138. select wait 1000 abort
  139. runback "WP:WP"
  140. select Workbench WordPerfect
  141. window resizeto 640,100
  142. wait
  143. menu Project New
  144. select Workbench "WordPerfect 4.1 - Doc 2"
  145. window resizeto 640,100
  146. wait
  147. window moveto 0,100
  148.  
  149.  
  150. Commented Version:
  151.  
  152. begin
  153. select wait 1000 abort
  154. ;; Run WordPerfect
  155. runback "WP:WP"
  156. ;; Wait for WP to show up on the Workbench screen
  157. select Workbench WordPerfect
  158. ;; Resize WP's window to 640 by 100
  159. window resizeto 640,100
  160. ;; Wait until resize operation is done.
  161. ;; You might have to increase the wait time if this isn't
  162. ;; enough.  (default wait is 25.. i.e. 1/2 second).
  163. wait
  164. ;; Select the menu 'Project' 'New' to open a new window.
  165. menu Project New
  166. ;; Wait until the second window shows up.
  167. select Workbench "WordPerfect 4.1 - Doc 2"
  168. ;; Resize second window to 640,100
  169. window resizeto 640,100
  170. ;; Wait again.
  171. wait
  172. ;; Move the second window to 0,100.
  173. window moveto 0,100
  174.  
  175. -----------------------------------------------------------------------------
  176.                                 Example 5
  177. -----------------------------------------------------------------------------
  178.  
  179. This is another WP example.  This time, however, it runs WP then loads in
  180. a specific file.
  181.  
  182. begin
  183. select wait 1000 abort
  184. runback "WP:WP"
  185. select Workbench WordPerfect
  186. menu Project "╗ Retrieve" File
  187. select Workbench Retrieve
  188. ;; Simulate the user typing "RAM:Test". (replace this with your own filename)
  189. key "RAM:Test"
  190. ;; Click on the Accept gadget
  191. gadget Accept
  192.  
  193.  
  194. You can easily merge examples 4 and 5 together and make WP load up any
  195. number of files you like!
  196.  
  197. -----------------------------------------------------------------------------
  198.                                 Example 6
  199. -----------------------------------------------------------------------------
  200.  
  201. Here's a script that'll load Professional Draw, bring up the file requester,
  202. enter the directory and filename and load the file:
  203.  
  204. begin
  205. select wait 1000 abort
  206. runback "PDraw:PDraw"
  207. select screen "Professional Draw"
  208. wait
  209. menu Project Open
  210. wait
  211. select window "Open Folio"
  212. gadget Drawer "PDraw:Drawings"
  213. wait
  214. gadget File   "HandFlyer"
  215.  
  216. -----------------------------------------------------------------------------
  217.                                 Example 7
  218. -----------------------------------------------------------------------------
  219.  
  220. Here's another script that'll load Professional Page, and then will create
  221. a new page (ready for work.)
  222.  
  223. begin
  224. select wait 1000 abort
  225. runback "PDraw:PDraw"
  226. select screen "Professional Draw"
  227. wait
  228. menu Page Create
  229. wait
  230. select window "New Page Format"
  231. gadget OK
  232.  
  233. -----------------------------------------------------------------------------
  234. Khalid Aldoseri    CIS 75166,2531                             7 October 1989.
  235. -----------------------------------------------------------------------------
  236.