home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 30 fixes_v / 30-fixes_v.zip / vxrx20a.zip / BUILDVRX.CMD < prev    next >
OS/2 REXX Batch file  |  1994-05-04  |  12KB  |  449 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. if( right( target_dir, 2 ) = ':\' )then do
  40.     target_dir = left( target_dir, length( target_dir ) - 1 );
  41. end
  42.  
  43. /*
  44.  * Clean things up first...
  45.  */
  46.  
  47. call CleanIni
  48. call AssignTypes
  49.  
  50. /*
  51.  * Create the main folder object
  52.  */
  53.  
  54. say 'Building Workplace Shell VX-REXX Objects...'
  55.  
  56. classname = 'WPFolder'
  57. title     = folder_title
  58. location  = '<WP_DESKTOP>'
  59. iconparm  = 'ICONFILE=' || target_dir || '\watcom2.ico;'
  60. setup     = 'OBJECTID=<VXREXX_FOLDER>;' || iconparm
  61.  
  62. call SysCreateObject classname, title, location, setup, 'r'
  63.  
  64. /*
  65.  * Create a Color Palette
  66.  */
  67.  
  68. classname = 'WPColorPalette'
  69. title     = 'Color Palette'
  70. location  = '<VXREXX_FOLDER>'
  71.  
  72. call SysCreateObject classname, title, location
  73.  
  74. /*
  75.  * Create a Font Palette
  76.  */
  77.  
  78. classname = 'WPFontPalette'
  79. title     = 'Font Palette'
  80. location  = '<VXREXX_FOLDER>'
  81.  
  82. call SysCreateObject classname, title, location
  83.  
  84. /*
  85.  * Create the book program objects
  86.  */
  87.  
  88. classname = 'WPProgram'
  89. title     = "VX-REXX" || "0a"x || "Programmer's Guide"
  90. location  = '<VXREXX_FOLDER>'
  91. setup     = 'EXENAME=view.exe;' ||,
  92.             'PROGTYPE=PM;' ||,
  93.             'PARAMETERS=' || target_dir || '\ProgGuid.INF;' ||,
  94.             'STARTUPDIR=' || target_dir || ';'
  95. call SysCreateObject classname, title, location, setup, 'r'
  96.  
  97. classname = 'WPProgram'
  98. title     = 'VX-REXX' || '0a'x || 'Reference'
  99. location  = '<VXREXX_FOLDER>'
  100. setup     = 'EXENAME=view.exe;' ||,
  101.             'PROGTYPE=PM;' ||,
  102.             'PARAMETERS=' || target_dir || '\A2Z.INF;' ||,
  103.             'STARTUPDIR=' || target_dir || ';'
  104. call SysCreateObject classname, title, location, setup, 'r'
  105.  
  106. classname = 'WPProgram'
  107. title     = 'VXQE Library'
  108. location  = '<VXREXX_FOLDER>'
  109. setup     = 'EXENAME=view.exe;' ||,
  110.             'PROGTYPE=PM;' ||,
  111.             'PARAMETERS=' || target_dir || '\VXQE.INF;' ||,
  112.             'STARTUPDIR=' || target_dir || ';'
  113. call SysCreateObject classname, title, location, setup, 'r'
  114.  
  115.  
  116.  
  117.  
  118. /*
  119.  * Create the projects folder
  120.  */
  121.  
  122. classname = 'WPShadow'
  123. title     = 'Projects'
  124. location  = '<VXREXX_FOLDER>'
  125. setup     = 'SHADOWID=' || target_dir || '\PROJECTS;OBJECTID=<VXREXX_PROJECTS>;'
  126.  
  127. call SysCreateObject classname, title, location, setup, 'r'
  128.  
  129. /*
  130.  * Create the Samples folder
  131.  */
  132.  
  133. classname = 'WPShadow'
  134. title     = 'Samples'
  135. location  = '<VXREXX_FOLDER>'
  136. setup     = 'SHADOWID=' || target_dir || '\SAMPLES;OBJECTID=<VXREXX_SAMPLES>;'
  137.  
  138. call SysCreateObject classname, title, location, setup, 'r'
  139.  
  140.  
  141. /*
  142.  * Create the Macros folder
  143.  */
  144.  
  145. classname = 'WPShadow'
  146. title     = 'Macros'
  147. location  = '<VXREXX_FOLDER>'
  148. setup     = 'SHADOWID=' || target_dir || '\MACROS;OBJECTID=<VXREXX_MACROS>;'
  149. call SysCreateObject classname, title, location, setup, 'r'
  150.  
  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 Readme program object
  167.     */
  168.     classname = 'WPProgram'
  169.     title     = 'Read Me First'
  170.     location  = '<VXREXX_FOLDER>'
  171.     setup     = 'EXENAME=view.exe;' ||,
  172.                 'PROGTYPE=PM;' ||,
  173.                 'PARAMETERS=' || target_dir || '\readme.inf;' ||,
  174.                 'STARTUPDIR=' || target_dir || ';'
  175.     call SysCreateObject classname, title, location, setup, 'r'
  176.  
  177.  
  178. /*
  179.  * Create the VX REXX program object
  180.  */
  181.  
  182. classname = 'WPProgram'
  183. title     = 'VX-REXX'
  184. location  = '<VXREXX_FOLDER>'
  185. setup     = 'EXENAME=' || target_dir || '\vrxedit.exe;' ||,
  186.             'PROGTYPE=PM;' ||,
  187.             'ASSOCFILTER=*.VRP;' ||,
  188.             'ASSOCTYPE=VX-REXX Project;'
  189.  
  190. call SysCreateObject classname, title, location, setup, 'r'
  191.  
  192. /*
  193.  * Create the VX REXX macro-launcher object
  194.  */
  195. /*
  196.     Don't include this for now.
  197.     Its presence in the VX-REXX folder is confusing.  People click on it and
  198.     expect something to happen.  Nothing does.
  199.  
  200.     We don't really expect people to drag and drop macros, or to rename them *.VRM and
  201.     double click on them.  Macro's are really only run from applications.
  202. */
  203. /*
  204. classname = 'WPProgram'
  205. title     = 'VX-REXX Macro'
  206. location  = '<VXREXX_FOLDER>'
  207. setup     = 'EXENAME=' || target_dir || '\vrx.exe;' ||,
  208.             'PROGTYPE=PM;' ||,
  209.             'ASSOCFILTER=*.VRM;' ||,
  210.             'ASSOCTYPE=VX-REXX Macro;'
  211.  
  212. call SysCreateObject classname, title, location, setup, 'r'
  213. */
  214.  
  215. /*
  216.  * Add the project template
  217.  */
  218.  
  219. call AddTemplate
  220.  
  221. /*
  222.  * Set the executable icon.
  223.  */
  224. call AddSample "Bounce",    "Bounce",           "Bounce"
  225. call AddSample "button",    "Button",           "Button"
  226. call AddSample "calc",      "Calculator",       "Calculat"
  227. call AddSample "DDE",       "DDE Explorer",     "DDE_Expl"
  228. call AddSample "DragDrop",  "DragDrop",         "DragDrop"
  229. call AddSample "FileBro",   "File browser",     "File_Bro"
  230. call AddSample "Focus",     "Hocus focus",      "Hocus_Fo"
  231. call AddSample "hinthelp",  "Hint and Help",    "Hint_And"
  232. call AddSample "mindgame",  "Mind Game",        "Mind_Gam"
  233. call AddSample "mmw",       "MMW",              "MMW"
  234. call AddSample "movies",    "Movies",           "Movies"
  235. call AddSample "Notebook",  "Notebook",         "Notebook"
  236. call AddSample "Popup",     "Popup",            "Popup"
  237. call AddSample "Printing",  "Printing",         "Printing"
  238. call AddSample "QEText",    "Q+E Text",         "Q!E_Text"
  239. call AddSample "RGB",       "RGB",              "RGB"
  240. call AddSample "threads",   "Threads",          "Threads"
  241. call AddSample "sampledb",  "Sample Database",  "Sample_d"
  242. call AddSample "UpdateDB",  "Update DB Sample", "Update_d"
  243. call AddSample "WinCtrl",   "Window Controller","Window_C"
  244.  
  245.  
  246. /*  Add an icon to run the EPM demos
  247. */
  248. call AddScan
  249.  
  250. exit
  251.  
  252. /****************************** End of Program ****************************/
  253.  
  254. /*
  255.  * AddTemplate
  256.  */
  257.  
  258. AddTemplate:
  259.  
  260.     classname = 'WPFolder'
  261.     title     = 'VX-REXX Project'
  262.     location  = target_dir || '\Projects'
  263.     setup     = 'OBJECTID=<VXREXX_TEMPLATE>;' ||,
  264.                 'TEMPLATE=yes;'
  265.  
  266.     call SysCreateObject classname, title, location, setup, 'r'
  267.  
  268.     classname = 'WPDataFile'
  269.     title     = 'Project.VRP'
  270.     location  = '<VXREXX_TEMPLATE>'
  271.     setup     = ''
  272.  
  273.     call SysCreateObject classname, title, location, setup, 'r'
  274.  
  275.     classname = 'WPDataFile'
  276.     title     = 'Window1.VRY'
  277.     location  = '<VXREXX_TEMPLATE>'
  278.     setup     = ''
  279.  
  280.     call SysCreateObject classname, title, location, setup, 'r'
  281.  
  282.     classname = 'WPDataFile'
  283.     title     = 'Window1.VRX'
  284.     location  = '<VXREXX_TEMPLATE>'
  285.     setup     = ''
  286.  
  287.     call SysCreateObject classname, title, location, setup, 'r'
  288.  
  289.     return
  290.  
  291.  
  292. AddSample:
  293. /*********
  294.     Parms:  1   directory name
  295.             2   long name
  296.             3   alternate directory name (8.3 equivalent of the long name)
  297. */
  298.     changeTitle = 0
  299.     startup     = target_dir || '\Samples\' || arg( 1 )
  300.     folder_name = startup
  301.     exe_parms = ''
  302.     exe_name  = arg( 1 ) || '.EXE'
  303.     ico_name  = arg( 1 ) || '.ICO'
  304.     vrp_name  = arg( 1 ) || '.VRP'
  305.  
  306.  
  307.     /*  Are the files in the original or the alternate directory?
  308.     */
  309.     filename =  startup || "\Source\" || vrp_name
  310.     if( stream( filename, "c", "open read" ) \= "READY:" ) then do
  311.         startup = target_dir || "\Samples\" || arg(3)
  312.         filename =  startup || "\Source\" || vrp_name
  313.         if( stream( filename, "c", "open read" ) \= "READY:" ) then do
  314.             return
  315.         end
  316.     end
  317.     else do
  318.         changeTitle = 1
  319.     end        
  320.     call stream filename, "c", "close"          
  321.  
  322.  
  323.     /*  Make a shadow of the VRP file
  324.     */
  325.     call SysCreateObject "WPShadow", arg(1) || ".VRP", folder_name,,
  326.             "SHADOWID=" || startup || "\Source\" || vrp_name || ";"
  327.     
  328.     /*  Make a program reference to the executable
  329.     */
  330.     classname = 'WPProgram'
  331.     title     = arg( 2 )
  332.     location  = folder_name
  333.     setup     = 'EXENAME=' || startup || '\Source\' || exe_name || ';' ||,
  334.                 'PROGTYPE=PM;' ||,
  335.                 'ICONFILE=' || startup || '\Source\' || ico_name || ';' ||,
  336.                 'STARTUPDIR=' || startup || '\Source\;' ||,
  337.                 'PARAMETERS=' || exe_parms || ';'
  338.     call SysCreateObject classname, title, location, setup, 'r'
  339.  
  340.     /*  Set the directory's long name
  341.     */
  342.     if changeTitle = 1 then do
  343.         call SysSetObjectData startup, "TITLE=" || arg(2) || ";"
  344.     end
  345.  
  346.     return
  347.  
  348. /*
  349.  * AddScan
  350.  */
  351.  
  352. AddScan:
  353.     startup     = target_dir || '\Samples\Scan'
  354.     folder_name = startup
  355.     ico_name    = 'Scan.ICO'
  356.  
  357.     classname = 'WPProgram'
  358.     title     = 'EPM with Scan'
  359.     location  = folder_name
  360.     setup     = 'EXENAME=epm.exe;' ||,
  361.                 'PROGTYPE=PM;' ||,
  362.                 'ICONFILE=' || startup || '\Source\' || ico_name || ';' ||,
  363.                 'STARTUPDIR=' || startup || '\Source;' ||,
  364.                 "PARAMETERS=scan.erx;"
  365.     call SysCreateObject classname, title, location, setup, 'r'
  366.  
  367.     /*  Set the directory's long name
  368.     */
  369.     call SysSetObjectData startup, "TITLE=Scan;"
  370.     
  371.     return
  372.     
  373.  
  374. /*
  375.  * AssignTypes -- Assigns the 'VX-REXX Project' type to all the .VRP files
  376.  *                that have been installed.
  377.  */
  378.  
  379. AssignTypes:
  380.  
  381.  
  382. /*
  383.     type      = 'VX-REXX Project'
  384.     typevalue = 'DFFF00000100FFDF'x || d2c(length(type)) || '00'x || type
  385.  
  386.     call SysIni 'USER', 'PMWP_ASSOC_TYPE', type
  387.     call SysIni 'USER', 'PMWP_ASSOC_FILTER', '*.VRP'
  388.  
  389.     call SysFileTree target_dir || '\*.VRP', 'files.', 'fso'
  390.  
  391.     do i = 1 to files.0
  392.         call SysPutEa files.i, '.TYPE', typevalue
  393.     end
  394.     */
  395.  
  396.     return
  397.  
  398. /*
  399.  * CleanIni -- Clean up the .INI file out of old VX-REXX information.
  400.  *             Cleans up old beta stuff, too.
  401.  */
  402.  
  403. CleanIni:
  404.     call SysIni 'user', 'PMWP_ASSOC_FILTER', '*.VRP', 'DELETE:'
  405.     call SysIni 'user', 'PMWP_ASSOC_TYPE', 'VX-REXX Project', 'DELETE:'
  406.     call SysIni 'user', 'PMWP_ASSOC_TYPE', 'VRx Project', 'DELETE:'
  407.  
  408.     call sysini 'user', 'PM_Workplace:Templates', 'All:', 'ids.'
  409.     do i = 1 to ids.0
  410.         if( pos( 'REXX', ids.i ) \= 0 & pos( 'VX', ids.i ) \= 0 & ,
  411.             pos( 'Project', ids.i ) \= 0 )then do
  412.             call SysIni 'user', 'PM_Workplace:Templates', ids.i, 'DELETE:'
  413.         end
  414.     
  415.         if( pos( 'VRx', ids.i ) \= 0 & pos( 'Project', ids.i ) \= 0 )then do
  416.             call SysIni 'user', 'PM_Workplace:Templates', ids.i, 'DELETE:'
  417.         end
  418.     end
  419.  
  420.     call SysDestroyObject '<VXREXX_SAMPLES>'
  421.     call SysDestroyObject '<VXREXX_TEMPLATE>'
  422.     call SysDestroyObject '<VXREXX_PROJECTS>'
  423.     call SysDestroyObject '<VXREXX_MACROS>'
  424.     call SysDestroyObject '<VXREXX_FOLDER>'
  425.  
  426.     return
  427.     
  428. /*
  429.  * FileExists
  430.  */
  431.     
  432. FileExists:
  433.     return( stream( arg(1), 'c', 'query exists' ) <> '' )
  434.  
  435. /*
  436.  * Usage
  437.  */
  438.  
  439. Usage:
  440.     say ''
  441.     say 'Usage: buildvrx [target_dir] [title]'
  442.     say ''
  443.     say '    target_dir   = path where WATCOM VX-REXX has been installed'
  444.     say '    title        = folder title (defaults to "WATCOM VX-REXX")'
  445.     say ''
  446.     say 'This program builds/rebuilds the various Workplace Shell objects'
  447.     say 'needed to run WATCOM VX-REXX.'
  448.     exit
  449.