home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / mpm1_28.zip / testrexx.cmd < prev    next >
OS/2 REXX Batch file  |  1995-10-05  |  10KB  |  220 lines

  1. /* TEXTREXX.CMD - Sample REXX command file for testing MaxFile/PM's REXX     */
  2. /* macro extensions.                                                         */
  3.  
  4. Say 'MaxFile/PM demo in progress.'
  5.  
  6. Call RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep'
  7.  
  8.  
  9. /* MPM_GetVersion() returns MaxFile/PM's revision number.                    */
  10.  
  11. mpmver = MPM_GetVersion()
  12.  
  13.  
  14. /* MPM_MsgBox(message, title) displays a simple message box using 'message'  */
  15. /* as the text displayed in the message box and 'title' as the title for the */
  16. /* message box.                                                              */
  17.  
  18. rc = MPM_MsgBox('Version 'mpmver, 'MaxFile/PM - Query Version Number')
  19.  
  20.  
  21. /* MPM_QueryArea([area tag]) works in two different ways.                    */
  22. /* Called with no arguments it returns the area tag of the first file area   */
  23. /* listed in the Main File Area window listing.                              */
  24. /* When called with a single argument containing the area tag of an existing */
  25. /* file area, it will return the area tag of the NEXT file area in the list. */
  26. /* In either case, if an area can't be found it returns 'ERROR'.             */
  27.  
  28. mpmarea = MPM_QueryArea()
  29. rc = MPM_MsgBox(mpmarea, 'MaxFile/PM - Query File Area')
  30.  
  31.  
  32. /* MPM_DeselectArea(area tag) detags a file area in the Main File Area       */
  33. /* window.                                                                   */
  34.  
  35. retval = MPM_DeselectArea(mpmarea)
  36. rc = MPM_MsgBox(retval, 'MaxFile/PM - Deselect File Area Results')
  37.  
  38.  
  39. /* See the MPM_QueryArea() comments above.                                   */
  40.  
  41. mpmarea = MPM_QueryArea(mpmarea)
  42. rc = MPM_MsgBox(mpmarea, 'MaxFile/PM - Query Next File Area')
  43.  
  44.  
  45. /* MPM_SelectArea(area tag) tags a file area in the Main File Area Window.   */
  46.  
  47. retval = MPM_SelectArea(mpmarea)
  48. rc = MPM_MsgBox(retval, 'MaxFile/PM - Select File Area Results')
  49.  
  50.  
  51. /* MPM_OpenArea(area tag) opens a FILES.BBS Window.                          */
  52.  
  53. retval = MPM_OpenArea(mpmarea)
  54. rc = MPM_MsgBox(retval, 'MaxFile/PM - Open File Area Results')
  55.  
  56.  
  57. /* MPM_IsAreaOpen(area tag) returns "1" if the FILES.BBS window associated   */
  58. /* with 'area tag' is open, "0" otherwise.                                   */
  59.  
  60. retval = MPM_IsAreaOpen(mpmarea)
  61. rc = MPM_MsgBox(retval, 'MaxFile/PM - Is File Area Open Results')
  62.  
  63.  
  64. /* MPM_SetFDUFlag(area tag) sets the File Database Utility flag for the      */
  65. /* FILES.BBS that is associated with 'area tag.' Use this to tell MaxFile/PM */
  66. /* that the File Database Utility needs to be run to update your file        */
  67. /* database after making changes that MaxFile/PM doesn't know about.         */
  68.  
  69. /* retval = MPM_SetFDUFlag(mpmarea) */
  70. /* rc = MPM_MsgBox(retval, 'MaxFile/PM - Set FD Utility Flag Results') */
  71.  
  72.  
  73. /* MPM_CloseArea(area tag) closes the FILES.BBS window associated with 'area */
  74. /* tag.'                                                                     */
  75.  
  76. retval = MPM_CloseArea(mpmarea)
  77. rc = MPM_MsgBox(retval, 'MaxFile/PM - Close File Area Results')
  78.  
  79.  
  80. /* MPM_QueryAreaInfo(area tag, '0' | '1' | '2') queries and returns the      */
  81. /* specified information for 'area tag.' The level info is as follows:       */
  82. /*                                                                           */
  83. /*                      0 - Area description                                 */
  84. /*                      1 - Download Path                                    */
  85. /*                      2 - FILES.BBS Location                               */
  86.  
  87. areainfo = MPM_QueryAreaInfo(mpmarea, '0')
  88. rc = MPM_MsgBox('Description = 'areainfo,,
  89.                 'MaxFile/PM - Query Area Info Results')
  90.  
  91. areainfo = MPM_QueryAreaInfo(mpmarea, '1')
  92. rc = MPM_MsgBox('Download Path = 'areainfo,,
  93.                 'MaxFile/PM - Query Area Info Results')
  94.  
  95. areainfo = MPM_QueryAreaInfo(mpmarea, '2')
  96. rc = MPM_MsgBox('FILES.BBS Location = 'areainfo,,
  97.                 'MaxFile/PM - Query Area Info Results')
  98.  
  99.  
  100. /*****************************************************************************/
  101. /*                                                                           */
  102. /* What follows is a simple example of querying information about an open    */
  103. /* file area.                                                                */
  104. /*                                                                           */
  105. /*****************************************************************************/
  106.  
  107. mpmarea = 'TEST'
  108.  
  109. /* Open up the file area */
  110. retval = MPM_OpenArea(mpmarea)
  111.  
  112. /* Give the open call a chance to work */
  113. Call SysSleep 3
  114.  
  115. /* Loop until the file area is open */
  116. areaopen = '0'
  117. do until areaopen \= '0'
  118.     Call SysSleep 1
  119.     areaopen = MPM_IsAreaOpen(mpmarea)
  120. end
  121.  
  122. /* MPM_QueryFile(area tag[, filename]) returns the base filename of a        */
  123. /* file from a FILES.BBS window. When called with just the area tag of an    */
  124. /* open window it returns the first file in the window. When called with     */
  125. /* both the area tag and an existing filename it will return the NEXT        */
  126. /* filename in the window. If something goes wrong it returns ERROR.         */
  127.  
  128. /* Query the filename of the first file */
  129. filename = MPM_QueryFile(mpmarea)
  130. rc = MPM_MsgBox('File = 'filename, 'MaxFile/PM - Query File Results')
  131.  
  132. if filename = 'ERROR' then do
  133.     exit
  134. end
  135.  
  136. /* Query the next filename */
  137. filename = MPM_QueryFile(mpmarea, filename)
  138. rc = MPM_MsgBox('File = 'filename, 'MaxFile/PM - Query File Results')
  139.  
  140. /* MPM_QueryFileInfo(area tag, filename, '0' | '1' | '2' | '3') queries      */
  141. /* and returns the specified information about 'filename.' The level         */
  142. /* information is as follows:                                                */
  143. /*                                                                           */
  144. /*                     0 - File Path                                         */
  145. /*                     1 - File Date in DD MMM YYYY format                   */
  146. /*                     3 - File Size                                         */
  147. /*                     4 - File Description                                  */
  148.  
  149. fileinfo = MPM_QueryFileInfo(mpmarea, filename, '0')
  150. rc = MPM_MsgBox('Filepath = 'fileinfo, 'MaxFile/PM - Query File Info Results')
  151.  
  152.  
  153. /* MPM_SelectFile/MPM_DeselectFile(area tag, filename) select and            */
  154. /* deselect 'filename', respectively, in the area identified by 'area        */
  155. /* tag'.                                                                     */
  156.  
  157. retval = MPM_SelectFile(mpmarea, filename)
  158. rc = MPM_MsgBox(filename' selected!', 'Select File')
  159.  
  160. fileinfo = MPM_QueryFileInfo(mpmarea, filename, '1')
  161. rc = MPM_MsgBox('Filedate = 'fileinfo, 'MaxFile/PM - Query File Info Results')
  162.  
  163. fileinfo = MPM_QueryFileInfo(mpmarea, filename, '2')
  164. rc = MPM_MsgBox('Filesize = 'fileinfo, 'MaxFile/PM - Query File Info Results')
  165.  
  166. fileinfo = MPM_QueryFileInfo(mpmarea, filename, '3')
  167. rc = MPM_MsgBox('File description = 'fileinfo,,
  168.                 'MaxFile/PM - Query File Info Results')
  169.  
  170. retval = MPM_DeselectFile(mpmarea, filename)
  171. rc = MPM_MsgBox(filename' deselected!', 'Deselect File')
  172.  
  173.  
  174. /* MPM_SetFileInfo(area tag, filename, '0' | '1' | '2') set the displayed    */
  175. /* information for a file in a FILES.BBS window. The level information is    */
  176. /* as follows:                                                               */
  177. /*                                                                           */
  178. /*                         0 - Set File Date                                 */
  179. /*                         1 - Set File Size                                 */
  180. /*                         2 - Set Description                               */
  181. /*                                                                           */
  182. /* Please note that options 0 and 1 are only for display purposes, if you    */
  183. /* want to set the file's date ("touch" it) you need to perform this         */
  184. /* yourself, MaxFile/PM does not do this for you, the same goes for the      */
  185. /* file's size. This REXX extension is merely to update the display in       */
  186. /* the FILES.BBS window. Option 2, for setting descriptions, does            */
  187. /* actually alter the description that will get saved for the file.          */
  188.  
  189. /* retval = MPM_SetFileInfo(mpmarea, filename, '2', 'Set with TESTREXX.CMD') */
  190. /* rc = MPM_MsgBox(retval, 'Set File Info Results') */
  191.  
  192.  
  193. /* MPM_RemoveFile(area tag, filename) removes the file 'filename' from       */
  194. /* the FILES.BBS window associated with 'area tag'.                          */
  195.  
  196. /* retval = MPM_RemoveFile(mpmarea, filename) */
  197. /* rc = MPM_MsgBox(retval, 'Remove File results') */
  198.  
  199.  
  200. /* MPM_AddFile(area tag, filename, description) adds 'filename' with         */
  201. /* description to the FILES.BBS window associated with 'area tag'.           */
  202. /* 'filename' MUST be a FULL file specification in the form of               */
  203. /* D:\PATH\FILENAME.EXE! The function returns 'ERROR' if something goes      */
  204. /* wrong.                                                                    */
  205.  
  206. /* retval = MPM_AddFile(mpmarea, 'd:\test\ivtech.zip', 'New File from REXX') */
  207. /* rc = MPM_MsgBox(retval, 'Add File Results') */
  208.  
  209.  
  210. /* Close the file area */
  211. retval = MPM_CloseArea(mpmarea)
  212.  
  213. /* MPM_Crc32(filename) returns a CRC32 for the specified file or ERROR if    */
  214. /* something goes wrong.                                                     */
  215. crc = MPM_Crc32('MPM1_20.ZIP')
  216. rc = MPM_MsgBox('MPM1_20.ZIP CRC32 = 'crc, 'MPM_Crc32 Results')
  217.  
  218.  
  219. rc = MPM_MsgBox('REXX Demo Complete!', 'MaxFile/PM - REXX Demo')
  220.