home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / BUILDVRX.CM$ / BUILDVRX.CMD
OS/2 REXX Batch file  |  1993-11-08  |  9KB  |  364 lines

  1. /*
  2.  * buildvrx.cmd -- Build the VX REXX folder and the associated
  3.  *                 icons.
  4.  */
  5.  
  6. address CMD
  7.  
  8. '@echo off'
  9.  
  10. call RXFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  11. call SysLoadFuncs
  12.  
  13. call setlocal
  14.  
  15. /*
  16.  * The target directory is the parm we were passed... make sure
  17.  * the directory exists...
  18.  */
  19.  
  20. target_dir   = ''
  21. folder_title = ''
  22.  
  23. parse arg target_dir folder_title
  24.  
  25. if( target_dir = '?' | target_dir = '/?' )then
  26.     call Usage
  27.  
  28. if( folder_title = '' )then
  29.     folder_title = 'WATCOM VX-REXX'
  30.  
  31. if( target_dir = '' )then
  32.     target_dir = directory()
  33.  
  34. if( directory( target_dir ) = '' )then
  35.     call Usage
  36.  
  37. target_dir = directory( target_dir )
  38.  
  39. /*
  40.  * Clean things up first...
  41.  */
  42.  
  43. call CleanIni
  44. call AssignTypes
  45.  
  46. /*
  47.  * Create the main folder object
  48.  */
  49.  
  50. say 'Building Workplace Shell VX-REXX Objects...'
  51.  
  52. classname = 'WPFolder'
  53. title     = folder_title
  54. location  = '<WP_DESKTOP>'
  55. iconparm  = 'ICONFILE=' || target_dir || '\watcom2.ico;'
  56. setup     = 'OBJECTID=<VXREXX_FOLDER>;' || iconparm
  57.  
  58. call SysCreateObject classname, title, location, setup, 'r'
  59.  
  60. /*
  61.  * Create a Color Palette
  62.  */
  63.  
  64. classname = 'WPColorPalette'
  65. title     = 'Color Palette'
  66. location  = '<VXREXX_FOLDER>'
  67.  
  68. call SysCreateObject classname, title, location
  69.  
  70. /*
  71.  * Create a Font Palette
  72.  */
  73.  
  74. classname = 'WPFontPalette'
  75. title     = 'Font Palette'
  76. location  = '<VXREXX_FOLDER>'
  77.  
  78. call SysCreateObject classname, title, location
  79.  
  80. /*
  81.  * Create the projects folder
  82.  */
  83.  
  84. classname = 'WPShadow'
  85. title     = 'Projects'
  86. location  = '<VXREXX_FOLDER>'
  87. setup     = 'SHADOWID=' || target_dir || '\PROJECTS;OBJECTID=<VXREXX_PROJECTS>;'
  88.  
  89. call SysCreateObject classname, title, location, setup, 'r'
  90.  
  91. /*
  92.  * Create the Samples folder
  93.  */
  94.  
  95. classname = 'WPShadow'
  96. title     = 'Samples'
  97. location  = '<VXREXX_FOLDER>'
  98. setup     = 'SHADOWID=' || target_dir || '\SAMPLES;OBJECTID=<VXREXX_SAMPLES>;'
  99.  
  100. call SysCreateObject classname, title, location, setup, 'r'
  101.  
  102.  
  103. /*
  104.  * Create the Macros folder
  105.  */
  106.  
  107. classname = 'WPShadow'
  108. title     = 'Macros'
  109. location  = '<VXREXX_FOLDER>'
  110. setup     = 'SHADOWID=' || target_dir || '\MACROS;OBJECTID=<VXREXX_MACROS>;'
  111. call SysCreateObject classname, title, location, setup, 'r'
  112.  
  113.  
  114. /*
  115.  * Create the book program objects
  116.  */
  117.  
  118. classname = 'WPProgram'
  119. title     = "Tutorial"
  120. location  = '<VXREXX_FOLDER>'
  121. setup     = 'EXENAME=view.exe;' ||,
  122.             'PROGTYPE=PM;' ||,
  123.             'PARAMETERS=' || target_dir || '\TUTBOOK.INF;' ||,
  124.             'STARTUPDIR=' || target_dir || ';'
  125.  
  126. call SysCreateObject classname, title, location, setup, 'r'
  127.  
  128. call SysCreateObject classname, title, location, setup, 'r'
  129.  
  130. /*
  131.  * Create a shadow of the REXX information
  132.  */
  133.  
  134. classname = 'WPProgram'
  135. title     = 'REXX Information'
  136. location  = '<VXREXX_FOLDER>'
  137. setup     = 'EXENAME=view.exe;' ||,
  138.             'PROGTYPE=PM;' ||,
  139.             'PARAMETERS=rexx.inf;'
  140.  
  141. call SysCreateObject classname, title, location, setup, 'r'
  142.  
  143. /*
  144.  * Create the VX REXX program object
  145.  */
  146.  
  147. classname = 'WPProgram'
  148. title     = 'VX-REXX'
  149. location  = '<VXREXX_FOLDER>'
  150. setup     = 'EXENAME=' || target_dir || '\vrxedit.exe;' ||,
  151.             'PROGTYPE=PM;' ||,
  152.             'ASSOCFILTER=*.VRP;' ||,
  153.             'ASSOCTYPE=VX-REXX Project;'
  154.  
  155. call SysCreateObject classname, title, location, setup, 'r'
  156.  
  157. /*
  158.  * Create the VX REXX macro-launcher object
  159.  */
  160. /*
  161.     Don't include this for now.
  162.     Its presence in the VX-REXX folder is confusing.  People click on it and
  163.     expect something to happen.  Nothing does.
  164.  
  165.     We don't really expect people to drag and drop macros, or to rename them *.VRM and
  166.     double click on them.  Macro's are really only run from applications.
  167. */
  168. /*
  169. classname = 'WPProgram'
  170. title     = 'VX-REXX Macro'
  171. location  = '<VXREXX_FOLDER>'
  172. setup     = 'EXENAME=' || target_dir || '\vrx.exe;' ||,
  173.             'PROGTYPE=PM;' ||,
  174.             'ASSOCFILTER=*.VRM;' ||,
  175.             'ASSOCTYPE=VX-REXX Macro;'
  176.  
  177. call SysCreateObject classname, title, location, setup, 'r'
  178. */
  179.  
  180. /*
  181.  * Add the project template
  182.  */
  183.  
  184. call AddTemplate
  185.  
  186. /*
  187.  * Set the executable icon.
  188.  */
  189. call AddSample "button",    "Button"
  190. call AddSample "calc",      "Calculator"
  191. call AddSample "mindgame",  "Mind Game"
  192. call AddSample "threads",   "Threads"
  193. call AddSample "sampledb",  "Sample Database"
  194. call AddSample "movies",    "Multimedia"
  195. call AddSample "hinthelp",  "Hint and Help"
  196. call AddSample "mmw",       "MMW"
  197. call AddSample "WinCtrl",   "Window Controller"
  198.  
  199. /*  Add an icon to run the EPM demos
  200. */
  201. call AddScan
  202.  
  203. exit
  204.  
  205. /****************************** End of Program ****************************/
  206.  
  207. /*
  208.  * AddTemplate
  209.  */
  210.  
  211. AddTemplate:
  212.  
  213.     classname = 'WPFolder'
  214.     title     = 'VX-REXX Project'
  215.     location  = target_dir || '\Projects'
  216.     setup     = 'OBJECTID=<VXREXX_TEMPLATE>;' ||,
  217.                 'TEMPLATE=yes;'
  218.  
  219.     call SysCreateObject classname, title, location, setup, 'r'
  220.  
  221.     classname = 'WPDataFile'
  222.     title     = 'Project.VRP'
  223.     location  = '<VXREXX_TEMPLATE>'
  224.     setup     = ''
  225.  
  226.     call SysCreateObject classname, title, location, setup, 'r'
  227.  
  228.     classname = 'WPDataFile'
  229.     title     = 'Window1.VRY'
  230.     location  = '<VXREXX_TEMPLATE>'
  231.     setup     = ''
  232.  
  233.     call SysCreateObject classname, title, location, setup, 'r'
  234.  
  235.     classname = 'WPDataFile'
  236.     title     = 'Window1.VRX'
  237.     location  = '<VXREXX_TEMPLATE>'
  238.     setup     = ''
  239.  
  240.     call SysCreateObject classname, title, location, setup, 'r'
  241.  
  242.     return
  243.  
  244. /*
  245.  * AddSample
  246.  */
  247.  
  248. AddSample:
  249.     startup     = target_dir || '\Samples\' || arg( 1 )
  250.     folder_name = startup
  251.     exe_parms = ''
  252.     exe_name  = arg( 1 ) || '.EXE'
  253.     ico_name  = arg( 1 ) || '.ICO'
  254.  
  255.     classname = 'WPProgram'
  256.     title     = arg( 2 )
  257.     location  = folder_name
  258.     setup     = 'EXENAME=' || startup || '\Bin\' || exe_name || ';' ||,
  259.                 'PROGTYPE=PM;' ||,
  260.                 'ICONFILE=' || startup || '\Bin\' || ico_name || ';' ||,
  261.                 'STARTUPDIR=' || startup || ';' ||,
  262.                 'PARAMETERS=' || exe_parms || ';'
  263.  
  264.     call SysCreateObject classname, title, location, setup, 'r'
  265.  
  266.     return
  267.  
  268. /*
  269.  * AddScan
  270.  */
  271.  
  272. AddScan:
  273.     startup     = target_dir || '\Samples\Scan'
  274.     folder_name = startup
  275.     ico_name    = 'Scan.ICO'
  276.  
  277.     classname = 'WPProgram'
  278.     title     = 'EPM with Scan'
  279.     location  = folder_name
  280.     setup     = 'EXENAME=epm.exe;' ||,
  281.                 'PROGTYPE=PM;' ||,
  282.                 'ICONFILE=' || startup || '\Bin\' || ico_name || ';' ||,
  283.                 'STARTUPDIR=' || startup || ';' ||,
  284.                 "PARAMETERS=bin\scan.erx 'rx bin\scan';"
  285.  
  286.     call SysCreateObject classname, title, location, setup, 'r'
  287.  
  288.     return
  289.     
  290.  
  291. /*
  292.  * AssignTypes -- Assigns the 'VX-REXX Project' type to all the .VRP files
  293.  *                that have been installed.
  294.  */
  295.  
  296. AssignTypes:
  297.  
  298.  
  299.     type      = 'VX-REXX Project'
  300.     typevalue = 'DFFF00000100FFDF'x || d2c(length(type)) || '00'x || type
  301.  
  302.     call SysIni 'USER', 'PMWP_ASSOC_TYPE', type
  303.     call SysIni 'USER', 'PMWP_ASSOC_FILTER', '*.VRP'
  304.  
  305.     call SysFileTree target_dir || '\*.VRP', 'files.', 'fso'
  306.  
  307.     do i = 1 to files.0
  308.         call SysPutEa files.i, '.TYPE', typevalue
  309.     end
  310.  
  311.     return
  312.  
  313. /*
  314.  * CleanIni -- Clean up the .INI file out of old VX-REXX information.
  315.  *             Cleans up old beta stuff, too.
  316.  */
  317.  
  318. CleanIni:
  319.     call SysIni 'user', 'PMWP_ASSOC_FILTER', '*.VRP', 'DELETE:'
  320.     call SysIni 'user', 'PMWP_ASSOC_TYPE', 'VX-REXX Project', 'DELETE:'
  321.     call SysIni 'user', 'PMWP_ASSOC_TYPE', 'VRx Project', 'DELETE:'
  322.  
  323.     call sysini 'user', 'PM_Workplace:Templates', 'All:', 'ids.'
  324.     do i = 1 to ids.0
  325.         if( pos( 'REXX', ids.i ) \= 0 & pos( 'VX', ids.i ) \= 0 & ,
  326.             pos( 'Project', ids.i ) \= 0 )then do
  327.             call SysIni 'user', 'PM_Workplace:Templates', ids.i, 'DELETE:'
  328.         end
  329.     
  330.         if( pos( 'VRx', ids.i ) \= 0 & pos( 'Project', ids.i ) \= 0 )then do
  331.             call SysIni 'user', 'PM_Workplace:Templates', ids.i, 'DELETE:'
  332.         end
  333.     end
  334.  
  335.     call SysDestroyObject '<VXREXX_SAMPLES>'
  336.     call SysDestroyObject '<VXREXX_TEMPLATE>'
  337.     call SysDestroyObject '<VXREXX_PROJECTS>'
  338.     call SysDestroyObject '<VXREXX_MACROS>'
  339.     call SysDestroyObject '<VXREXX_FOLDER>'
  340.  
  341.     return
  342.     
  343. /*
  344.  * FileExists
  345.  */
  346.     
  347. FileExists:
  348.     return( stream( arg(1), 'c', 'query exists' ) <> '' )
  349.  
  350. /*
  351.  * Usage
  352.  */
  353.  
  354. Usage:
  355.     say ''
  356.     say 'Usage: buildvrx [target_dir] [title]'
  357.     say ''
  358.     say '    target_dir   = path where WATCOM VX-REXX has been installed'
  359.     say '    title        = folder title (defaults to "WATCOM VX-REXX")'
  360.     say ''
  361.     say 'This program builds/rebuilds the various Workplace Shell objects'
  362.     say 'needed to run WATCOM VX-REXX.'
  363.     exit
  364.