home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 30 fixes_v / 30-fixes_v.zip / vxrx101.zip / BUILDVRX.CMD < prev    next >
OS/2 REXX Batch file  |  1993-09-17  |  10KB  |  386 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     = "Programmer's Guide"
  120. location  = '<VXREXX_FOLDER>'
  121. setup     = 'EXENAME=view.exe;' ||,
  122.             'PROGTYPE=PM;' ||,
  123.             'PARAMETERS=' || target_dir || '\ProgGuid.INF;' ||,
  124.             'STARTUPDIR=' || target_dir || ';'
  125.  
  126. call SysCreateObject classname, title, location, setup, 'r'
  127.  
  128. classname = 'WPProgram'
  129. title     = 'Reference'
  130. location  = '<VXREXX_FOLDER>'
  131. setup     = 'EXENAME=view.exe;' ||,
  132.             'PROGTYPE=PM;' ||,
  133.             'PARAMETERS=' || target_dir || '\A2Z.INF;' ||,
  134.             'STARTUPDIR=' || target_dir || ';'
  135.  
  136. call SysCreateObject classname, title, location, setup, 'r'
  137.  
  138. /*
  139.  * Create the Readme program object
  140.  */
  141.  
  142. classname = 'WPProgram'
  143. title     = 'Read Me First'
  144. location  = '<VXREXX_FOLDER>'
  145. setup     = 'EXENAME=view.exe;' ||,
  146.             'PROGTYPE=PM;' ||,
  147.             'PARAMETERS=' || target_dir || '\readme.inf;' ||,
  148.             'STARTUPDIR=' || target_dir || ';'
  149.  
  150. call SysCreateObject classname, title, location, setup, 'r'
  151.  
  152. /*
  153.  * Create a shadow of the REXX information
  154.  */
  155.  
  156. classname = 'WPProgram'
  157. title     = 'REXX Information'
  158. location  = '<VXREXX_FOLDER>'
  159. setup     = 'EXENAME=view.exe;' ||,
  160.             'PROGTYPE=PM;' ||,
  161.             'PARAMETERS=rexx.inf;'
  162.  
  163. call SysCreateObject classname, title, location, setup, 'r'
  164.  
  165. /*
  166.  * Create the VX REXX program object
  167.  */
  168.  
  169. classname = 'WPProgram'
  170. title     = 'VX-REXX'
  171. location  = '<VXREXX_FOLDER>'
  172. setup     = 'EXENAME=' || target_dir || '\vrxedit.exe;' ||,
  173.             'PROGTYPE=PM;' ||,
  174.             'ASSOCFILTER=*.VRP;' ||,
  175.             'ASSOCTYPE=VX-REXX Project;'
  176.  
  177. call SysCreateObject classname, title, location, setup, 'r'
  178.  
  179. /*
  180.  * Create the VX REXX macro-launcher object
  181.  */
  182. /*
  183.     Don't include this for now.
  184.     Its presence in the VX-REXX folder is confusing.  People click on it and
  185.     expect something to happen.  Nothing does.
  186.  
  187.     We don't really expect people to drag and drop macros, or to rename them *.VRM and
  188.     double click on them.  Macro's are really only run from applications.
  189. */
  190. /*
  191. classname = 'WPProgram'
  192. title     = 'VX-REXX Macro'
  193. location  = '<VXREXX_FOLDER>'
  194. setup     = 'EXENAME=' || target_dir || '\vrx.exe;' ||,
  195.             'PROGTYPE=PM;' ||,
  196.             'ASSOCFILTER=*.VRM;' ||,
  197.             'ASSOCTYPE=VX-REXX Macro;'
  198.  
  199. call SysCreateObject classname, title, location, setup, 'r'
  200. */
  201.  
  202. /*
  203.  * Add the project template
  204.  */
  205.  
  206. call AddTemplate
  207.  
  208. /*
  209.  * Set the executable icon.
  210.  */
  211. call AddSample "button",    "Button"
  212. call AddSample "calc",      "Calculator"
  213. call AddSample "mindgame",  "Mind Game"
  214. call AddSample "threads",   "Threads"
  215. call AddSample "sampledb",  "Sample Database"
  216. call AddSample "movies",    "Multimedia"
  217. call AddSample "hinthelp",  "Hint and Help"
  218. call AddSample "mmw",       "MMW"
  219. call AddSample "WinCtrl",   "Window Controller"
  220.  
  221. /*  Add an icon to run the EPM demos
  222. */
  223. call AddScan
  224.  
  225. exit
  226.  
  227. /****************************** End of Program ****************************/
  228.  
  229. /*
  230.  * AddTemplate
  231.  */
  232.  
  233. AddTemplate:
  234.  
  235.     classname = 'WPFolder'
  236.     title     = 'VX-REXX Project'
  237.     location  = target_dir || '\Projects'
  238.     setup     = 'OBJECTID=<VXREXX_TEMPLATE>;' ||,
  239.                 'TEMPLATE=yes;'
  240.  
  241.     call SysCreateObject classname, title, location, setup, 'r'
  242.  
  243.     classname = 'WPDataFile'
  244.     title     = 'Project.VRP'
  245.     location  = '<VXREXX_TEMPLATE>'
  246.     setup     = ''
  247.  
  248.     call SysCreateObject classname, title, location, setup, 'r'
  249.  
  250.     classname = 'WPDataFile'
  251.     title     = 'Window1.VRY'
  252.     location  = '<VXREXX_TEMPLATE>'
  253.     setup     = ''
  254.  
  255.     call SysCreateObject classname, title, location, setup, 'r'
  256.  
  257.     classname = 'WPDataFile'
  258.     title     = 'Window1.VRX'
  259.     location  = '<VXREXX_TEMPLATE>'
  260.     setup     = ''
  261.  
  262.     call SysCreateObject classname, title, location, setup, 'r'
  263.  
  264.     return
  265.  
  266. /*
  267.  * AddSample
  268.  */
  269.  
  270. AddSample:
  271.     startup     = target_dir || '\Samples\' || arg( 1 )
  272.     folder_name = startup
  273.     exe_parms = ''
  274.     exe_name  = arg( 1 ) || '.EXE'
  275.     ico_name  = arg( 1 ) || '.ICO'
  276.  
  277.     classname = 'WPProgram'
  278.     title     = arg( 2 )
  279.     location  = folder_name
  280.     setup     = 'EXENAME=' || startup || '\Bin\' || exe_name || ';' ||,
  281.                 'PROGTYPE=PM;' ||,
  282.                 'ICONFILE=' || startup || '\Bin\' || ico_name || ';' ||,
  283.                 'STARTUPDIR=' || startup || ';' ||,
  284.                 'PARAMETERS=' || exe_parms || ';'
  285.  
  286.     call SysCreateObject classname, title, location, setup, 'r'
  287.  
  288.     return
  289.  
  290. /*
  291.  * AddScan
  292.  */
  293.  
  294. AddScan:
  295.     startup     = target_dir || '\Samples\Scan'
  296.     folder_name = startup
  297.     ico_name    = 'Scan.ICO'
  298.  
  299.     classname = 'WPProgram'
  300.     title     = 'EPM with Scan'
  301.     location  = folder_name
  302.     setup     = 'EXENAME=epm.exe;' ||,
  303.                 'PROGTYPE=PM;' ||,
  304.                 'ICONFILE=' || startup || '\Bin\' || ico_name || ';' ||,
  305.                 'STARTUPDIR=' || startup || ';' ||,
  306.                 "PARAMETERS=bin\scan.erx 'rx bin\scan';"
  307.  
  308.     call SysCreateObject classname, title, location, setup, 'r'
  309.  
  310.     return
  311.     
  312.  
  313. /*
  314.  * AssignTypes -- Assigns the 'VX-REXX Project' type to all the .VRP files
  315.  *                that have been installed.
  316.  */
  317.  
  318. AssignTypes:
  319.  
  320.  
  321.     type      = 'VX-REXX Project'
  322.     typevalue = 'DFFF00000100FFDF'x || d2c(length(type)) || '00'x || type
  323.  
  324.     call SysIni 'USER', 'PMWP_ASSOC_TYPE', type
  325.     call SysIni 'USER', 'PMWP_ASSOC_FILTER', '*.VRP'
  326.  
  327.     call SysFileTree target_dir || '\*.VRP', 'files.', 'fso'
  328.  
  329.     do i = 1 to files.0
  330.         call SysPutEa files.i, '.TYPE', typevalue
  331.     end
  332.  
  333.     return
  334.  
  335. /*
  336.  * CleanIni -- Clean up the .INI file out of old VX-REXX information.
  337.  *             Cleans up old beta stuff, too.
  338.  */
  339.  
  340. CleanIni:
  341.     call SysIni 'user', 'PMWP_ASSOC_FILTER', '*.VRP', 'DELETE:'
  342.     call SysIni 'user', 'PMWP_ASSOC_TYPE', 'VX-REXX Project', 'DELETE:'
  343.     call SysIni 'user', 'PMWP_ASSOC_TYPE', 'VRx Project', 'DELETE:'
  344.  
  345.     call sysini 'user', 'PM_Workplace:Templates', 'All:', 'ids.'
  346.     do i = 1 to ids.0
  347.         if( pos( 'REXX', ids.i ) \= 0 & pos( 'VX', ids.i ) \= 0 & ,
  348.             pos( 'Project', ids.i ) \= 0 )then do
  349.             call SysIni 'user', 'PM_Workplace:Templates', ids.i, 'DELETE:'
  350.         end
  351.     
  352.         if( pos( 'VRx', ids.i ) \= 0 & pos( 'Project', ids.i ) \= 0 )then do
  353.             call SysIni 'user', 'PM_Workplace:Templates', ids.i, 'DELETE:'
  354.         end
  355.     end
  356.  
  357.     call SysDestroyObject '<VXREXX_SAMPLES>'
  358.     call SysDestroyObject '<VXREXX_TEMPLATE>'
  359.     call SysDestroyObject '<VXREXX_PROJECTS>'
  360.     call SysDestroyObject '<VXREXX_MACROS>'
  361.     call SysDestroyObject '<VXREXX_FOLDER>'
  362.  
  363.     return
  364.     
  365. /*
  366.  * FileExists
  367.  */
  368.     
  369. FileExists:
  370.     return( stream( arg(1), 'c', 'query exists' ) <> '' )
  371.  
  372. /*
  373.  * Usage
  374.  */
  375.  
  376. Usage:
  377.     say ''
  378.     say 'Usage: buildvrx [target_dir] [title]'
  379.     say ''
  380.     say '    target_dir   = path where WATCOM VX-REXX has been installed'
  381.     say '    title        = folder title (defaults to "WATCOM VX-REXX")'
  382.     say ''
  383.     say 'This program builds/rebuilds the various Workplace Shell objects'
  384.     say 'needed to run WATCOM VX-REXX.'
  385.     exit
  386.