home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0920.lha / TypeSmithDemo / ARexxDemo.tsrx next >
Text File  |  1993-10-04  |  7KB  |  369 lines

  1. /* Demonstration of TypeSmith's ARexx Capabilities */
  2.  
  3. ADDRESS 'TYPESMITH'
  4. OPTIONS RESULTS
  5. TRACE OFF
  6.  
  7. /* Screen to front */
  8.  
  9. TO_FRONT
  10.  
  11. /* Get the version number of TypeSmith and store it in RESULT */
  12.  
  13. VERSION
  14.  
  15. /* The underscore character in front of a string is for hotkeys.
  16. ** It will be filtered out if you have `Use system requesters'
  17. ** turned on.
  18. */
  19.  
  20. DISPLAY_ALERT 'Welcome to a demonstration of TypeSmith 'TRUNC(RESULT/100,2) 'and ARexx!|_Continue|_Exit'
  21.  
  22. if RC = 5 then EXIT
  23.  
  24. /* open a requester with a text gadget */
  25.  
  26. GET_STRING 'What is your name?|_Continue|_Exit'
  27.  
  28. if RC = 5 then RESULT = 'No Name'
  29.  
  30. name = RESULT
  31.  
  32. DISPLAY_ALERT 'Hi 'name'!|_Continue|_Exit'
  33.  
  34. if RC = 5 then EXIT
  35.  
  36. /* Ask for permission to start a new font */
  37.  
  38. DISPLAY_ALERT name', can I clear the existing font?|_Continue|_Exit'
  39.  
  40. if RC = 5 then EXIT
  41.  
  42. DISPLAY_ALERT 'First, we will start a new font...|_Continue|_Exit'
  43.  
  44. if RC = 5 then EXIT
  45.  
  46. /* Start a new font, open a character window, name it and size the window */
  47.  
  48. NEW_FONT
  49. NEW_METRIC
  50. SET_FONTNAME 'ARexx Demonstration'
  51. SET_FAMILY 'ARexxDemo'
  52. SET_WEIGHT 'Normal'
  53. SET_FULLNAME 'ARexxDemoNormal'
  54. SET_FONTID '999'
  55. SET_NOTICE 'This is only a test folks...'
  56. SIZE_WINDOW 550 600
  57. SHOW_FILLED 0
  58.  
  59. DISPLAY_ALERT 'I will now draw a letter 'A'.|_Continue|_Exit'
  60.  
  61. if RC = 5 then EXIT
  62.  
  63. /* draw a serif 'A' */
  64.  
  65. MOVETO 18 2
  66. LINETO 18 20
  67. CURVETO 54 20 81 39 105 97
  68. LINETO 336 651
  69. LINETO 358 651
  70. LINETO 606 73
  71. CURVETO 626 32 650 20 683 20
  72. LINETO 683 1
  73. LINETO 438 1
  74. LINETO 438 20
  75. CURVETO 495 20 512 37 503 73
  76. LINETO 447 208
  77. LINETO 197 208
  78. LINETO 153 97
  79. CURVETO 127 46 139 20 209 20
  80. LINETO 209 1
  81. CLOSEPATH
  82.  
  83. MOVETO 211 251
  84. LINETO 433 251
  85. LINETO 322 512
  86. CLOSEPATH
  87.  
  88. DISPLAY_ALERT 'Now I will zoom in and out a bit...|_Continue|_Exit'
  89.  
  90. if RC = 5 then EXIT
  91.  
  92. /* set the scaling factor a bit */
  93.  
  94. SET_SCALE 4
  95. SET_SCALE 5
  96. SET_SCALE 6
  97. SET_SCALE 7
  98. SET_SCALE 6
  99. SET_SCALE 5
  100. SET_SCALE 4
  101. SET_SCALE 3
  102. SET_SCALE 2
  103. SET_SCALE 3
  104.  
  105. DISPLAY_ALERT 'TypeSmith can show characters filled or unfilled...|_Continue|_Exit'
  106.  
  107. if RC = 5 then EXIT
  108.  
  109. /* show character as filled */
  110.  
  111. SHOW_FILLED 1
  112.  
  113. DISPLAY_ALERT 'But it is easier to work with just outlines...|_Continue|_Exit'
  114.  
  115. if RC = 5 then EXIT
  116.  
  117. /* show characters as unfilled */
  118.  
  119. SHOW_FILLED 0
  120.  
  121. DISPLAY_ALERT 'I will now select the first point in the first path.|_Continue|_Exit'
  122.  
  123. if RC = 5 then EXIT
  124.  
  125. /* select the first point of the first path */
  126.  
  127. FIRST_PATH
  128.  
  129. DISPLAY_ALERT 'I can find out its coordinates...|_Continue|_Exit'
  130.  
  131. if RC = 5 then EXIT
  132.  
  133. /* get coordinates of point */
  134.  
  135. GET_POINTX
  136. pointx = RESULT
  137. GET_POINTY
  138. pointy = RESULT
  139.  
  140. DISPLAY_ALERT 'Point x='pointx' y='pointy'|_Continue|_Exit'
  141.  
  142. if RC = 5 then EXIT
  143.  
  144. DISPLAY_ALERT 'I can change the coordinates of a point...|_Continue|_Exit'
  145.  
  146. if RC = 5 then EXIT
  147.  
  148. SET_POINT 100 100 0 0 0 0
  149.  
  150. DISPLAY_ALERT 'I will change it back now...|_Continue|_Exit'
  151.  
  152. if RC = 5 then EXIT
  153.  
  154. SET_POINT pointx pointy 0 0 0 0
  155.  
  156. DISPLAY_ALERT 'Watch me select various points in this path...|_Continue|_Exit'
  157.  
  158. if RC = 5 then EXIT
  159.  
  160. /* select the next point in this path, then continue... */
  161.  
  162. NEXT_POINT
  163. NEXT_POINT
  164. NEXT_POINT
  165. NEXT_POINT
  166. NEXT_POINT
  167. PREVIOUS_POINT
  168. PREVIOUS_POINT
  169. GOTO_START
  170.  
  171. DISPLAY_ALERT 'Now I will select all the points in the first path.|_Continue|_Exit'
  172.  
  173. if RC = 5 then EXIT
  174.  
  175. /* select all the points in the path */
  176.  
  177. SELECT_PATH
  178.  
  179. DISPLAY_ALERT 'Now I will select all the points in the second path.|_Continue|_Exit'
  180.  
  181. if RC = 5 then EXIT
  182.  
  183. /* select the first point of the next path next_path only works when 1
  184.    point is selected, thus we need to use first_path again */
  185.  
  186. FIRST_PATH
  187. NEXT_PATH
  188. SELECT_PATH
  189.  
  190. DISPLAY_ALERT 'I can even switch back and forth between paths...|_Continue|_Exit'
  191.  
  192. if RC = 5 then EXIT
  193.  
  194. /* select one path, then all its points, then the other path... */
  195.  
  196. FIRST_PATH
  197. NEXT_PATH
  198. PREVIOUS_PATH
  199. NEXT_PATH
  200. PREVIOUS_PATH
  201.  
  202. DISPLAY_ALERT 'And I can select all the points in a specified area...|_Continue|_Exit'
  203. if RC = 5 then EXIT
  204.  
  205. /* select an area */
  206.  
  207. SELECT_AREA 0 0 250 250
  208.  
  209. DISPLAY_ALERT 'Now I will select all the points in both paths.|_Continue|_Exit'
  210.  
  211. if RC = 5 then EXIT
  212.  
  213. /* select all the points in the character */
  214.  
  215. SELECT_ALL
  216.  
  217. DISPLAY_ALERT 'Watch me rotate the A.|_Continue|_Exit'
  218.  
  219. if RC = 5 then EXIT
  220.  
  221. /* rotate all the selected points */
  222.  
  223. ROTATE 5
  224. ROTATE 5
  225. ROTATE 5
  226. ROTATE 5
  227. ROTATE 5
  228.  
  229. DISPLAY_ALERT 'Watch me skew the A now.|_Continue|_Exit'
  230.  
  231. if RC = 5 then EXIT
  232.  
  233. /* skew all the selected points */
  234.  
  235. SKEW 5
  236. SKEW 5
  237. SKEW 5
  238. SKEW 5
  239. SKEW 5
  240.  
  241. DISPLAY_ALERT 'Watch me flip the A.|_Continue|_Exit'
  242.  
  243. if RC = 5 then EXIT
  244.  
  245. /* flip horizontally and vertically */
  246.  
  247. FLIP 0
  248. FLIP 1
  249. FLIP 0
  250. FLIP 1
  251.  
  252. DISPLAY_ALERT 'I can make it bigger...|_Continue|_Exit'
  253.  
  254. if RC = 5 then EXIT
  255.  
  256. /* scale it */
  257.  
  258. SCALE 110 100
  259. SCALE 110 100
  260. SCALE 110 100
  261. SCALE 100 110
  262. SCALE 100 110
  263. SCALE 100 110
  264.  
  265. DISPLAY_ALERT '...and make it smaller.|_Continue|_Exit'
  266.  
  267. if RC = 5 then EXIT
  268.  
  269. /* scale it down */
  270.  
  271. SCALE 90 90
  272. SCALE 90 90
  273. SCALE 90 90
  274.  
  275. DISPLAY_ALERT 'I can move paths, too.|_Continue|_Exit'
  276.  
  277. if RC = 5 then EXIT
  278.  
  279. /* move it */
  280.  
  281. MOVE 5 5
  282. MOVE 10 10
  283. MOVE 15 15
  284. MOVE 20 20
  285. MOVE 25 25
  286. MOVE '-25 0'
  287. MOVE '-20 0'
  288. MOVE '-15 0'
  289. MOVE '-10 0'
  290. MOVE '-5 0'
  291.  
  292. DISPLAY_ALERT 'Or I can make you see double.|_Continue|_Exit'
  293.  
  294. if RC = 5 then EXIT
  295.  
  296. /* duplicate the paths and then offset them */
  297.  
  298. COPY
  299. PASTE
  300. MOVE 100 100
  301.  
  302. DISPLAY_ALERT 'I will get rid of the copy.|_Continue|_Exit'
  303.  
  304. if RC = 5 then EXIT
  305.  
  306. DELETE
  307.  
  308. DISPLAY_ALERT 'I can even make it disappear...|_Continue|_Exit'
  309.  
  310. if RC = 5 then EXIT
  311.  
  312. /* cut the paths to the clipboard */
  313.  
  314. SELECT_ALL
  315. CUT
  316.  
  317. DISPLAY_ALERT '...and make it re-appear.|_Continue|_Exit'
  318.  
  319. if RC = 5 then EXIT
  320.  
  321. /* paste it back */
  322.  
  323. PASTE
  324.  
  325. DISPLAY_ALERT 'Watch me change the screen order.|_Continue|_Exit'
  326.  
  327. if RC = 5 then EXIT
  328.  
  329. /* Move the screen to the back and then back to the front.
  330.    Use the timer for a delay using standard ARexx commands */
  331.  
  332. loop=0
  333. do while loop<3
  334.     TO_BACK
  335.     call time('R')
  336.     kount=time('E')
  337.     do while kount<.15
  338.         kount=time('E')
  339.     end
  340.     TO_FRONT
  341.     call time('R')
  342.     kount=time('E')
  343.     do while kount<.15
  344.         kount=time('E')
  345.     end
  346.     loop=loop+1
  347. end
  348.  
  349. DISPLAY_ALERT 'I can open a file requester to let you choose files...|_Continue|_Exit'
  350.  
  351. if RC = 5 then EXIT
  352.  
  353. /* open a file requester and get a file path and name */
  354.  
  355. GET_FILE 'Choose any file...|_Ok|ram:|'
  356.  
  357. /* if Cancel is selected, then change the result to no file selected */
  358.  
  359. if RC = 5 then RESULT = '<no file selected!>'
  360.  
  361. DISPLAY_ALERT 'The file you chose was: 'RESULT'|_Continue|_Exit'
  362.  
  363. if RC = 5 then EXIT
  364.  
  365. DISPLAY_ALERT 'This is the end of the demonstration.|_Continue'
  366. DISPLAY_ALERT 'Call 1-800-829-8608 to order TypeSmith today!|_Continue'
  367. DISPLAY_ALERT 'International: 314-894-8608. Fax: 314-894-3280|_Continue'
  368. DISPLAY_ALERT 'I will return control to you now.|_Bye!'
  369.