home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 30 fixes_v / 30-fixes_v.zip / vxrxs21a.zip / BUILDVRX.CMD next >
OS/2 REXX Batch file  |  1994-10-11  |  14KB  |  448 lines

  1. /************************************************/
  2. /* BUILDVRX.CMD : Build VX-REXX Desktop objects */
  3. /************************************************/
  4.  
  5. address CMD
  6.  
  7. '@echo off'
  8.  
  9. call RXFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  10. call SysLoadFuncs
  11.  
  12. call setlocal
  13.  
  14. target_dir   = ''
  15. szVideoMode = ''
  16.  
  17. parse arg target_dir szVideoMode
  18.  
  19. if( target_dir = '?' | target_dir = '/?') then
  20.     call Usage
  21.  
  22. if (szVideoMode \= "1024x768" & szVideoMode \= "800x600" & szVideoMode \= "640x480") then do
  23.    szVideoMode = "640x480"
  24. end
  25.  
  26. if (szVideoMode = "") then do
  27.    szVideoMode = "640x480"
  28. end
  29.  
  30. folder_title = 'Watcom VX-REXX'
  31.  
  32.  
  33. if( target_dir = '' )then
  34.     target_dir = directory()
  35. else do
  36.     if( lastpos( "\", target_dir ) = length( target_dir ) ) then do
  37.         target_dir = left( target_dir, length( target_dir ) - 1 )
  38.     end
  39. end
  40.  
  41. if( directory( target_dir ) = '' )then
  42.     call Usage
  43.  
  44. target_dir = directory( target_dir )
  45.  
  46. bldDemo = 0
  47. if( FileExists( target_dir || '\TUTBOOK.INF' ) )then do
  48.     bldDemo = 1
  49. end
  50.  
  51. call CleanIni
  52.  
  53. call AddTemplate
  54.  
  55. /* Accomodate for different resolution modes */
  56.  
  57.  
  58. x = 5;
  59. if (szVideoMode = "1024x768") then do
  60.    y = 45;
  61.    nDeltaY = -10;
  62.    nDeltaX = 13;
  63. end
  64. if (szVideoMode = "640x480") then do
  65.    y = 60;
  66.    nDeltaY = -15;
  67.    nDeltaX = 15;
  68. end
  69. if (szVideoMode = "800x600") then do
  70.    y = 60;
  71.    nDeltaY = -15;
  72.    nDeltaX = 15;
  73. end
  74.  
  75. /* Create main folder object */
  76.  
  77. say 'Building Workplace Shell VX-REXX Objects...'
  78.  
  79. classname = 'WPFolder'
  80. title     = folder_title
  81. location  = '<WP_DESKTOP>'
  82. iconparm  = 'ICONFILE=' || target_dir || '\watcom2.ico;'
  83. setup     = 'OBJECTID=<VXREXX_FOLDER>;' || iconparm
  84.  
  85. call SysCreateObject classname, title, location, setup, 'r'
  86.  
  87.  
  88.  
  89. /* Create the Readme program object */
  90.  
  91. x = 5;
  92. y = y + nDeltaY;
  93. classname = 'WPProgram'
  94. title     = 'Read Me First'
  95. location  = '<VXREXX_FOLDER>'
  96. setup     = 'EXENAME=view.exe;' ||,
  97.             'PROGTYPE=PM;' ||,
  98.             'PARAMETERS=' || target_dir || '\readme.inf;' ||,
  99.             'ICONPOS=' || x || ',' || y || ';' ||,
  100.             'STARTUPDIR=' || target_dir || ';'
  101. call SysCreateObject classname, title, location, setup, 'r'
  102.  
  103. /* Create tutorial (demo only) */
  104.  
  105. if( bldDemo = 1 )then do
  106.     x = x + nDeltaX;
  107.     classname = 'WPProgram'
  108.     title     = 'VX-REXX' || '0a'x || 'Tutorial'
  109.     location  = '<VXREXX_FOLDER>'
  110.     setup     = 'EXENAME=view.exe;' ||,
  111.                 'PROGTYPE=PM;' ||,
  112.                 'PARAMETERS=' || target_dir || '\TUTBOOK.INF;' ||,
  113.                 'ICONPOS=' x || "," || y || ";" ||,
  114.                 'STARTUPDIR=' || target_dir || ';'
  115.     call SysCreateObject classname, title, location, setup, 'r'
  116. end
  117.  
  118. /* Create Programmer's Guide Object */
  119.  
  120. x = x + nDeltaX;
  121. classname = 'WPProgram'
  122. title     = "VX-REXX" || "0a"x || "Programmer's Guide"
  123. location  = '<VXREXX_FOLDER>'
  124. setup     = 'EXENAME=view.exe;' ||,
  125.             'PROGTYPE=PM;' ||,
  126.             'PARAMETERS=' || target_dir || '\ProgGuid.INF;' ||,
  127.             'ICONPOS=' x || "," || y || ";" ||,
  128.             'STARTUPDIR=' || target_dir || ';'
  129. call SysCreateObject classname, title, location, setup, 'r'
  130.  
  131.  
  132. /* Create VX-REXX Reference Object */
  133.  
  134. x = x + nDeltaX;
  135. classname = 'WPProgram'
  136. title     = 'VX-REXX' || '0a'x || 'Reference'
  137. location  = '<VXREXX_FOLDER>'
  138. setup     = 'EXENAME=view.exe;' ||,
  139.             'PROGTYPE=PM;' ||,
  140.             'PARAMETERS=' || target_dir || '\A2Z.INF;' ||,
  141.             'ICONPOS=' x || "," || y || ";" ||,
  142.             'STARTUPDIR=' || target_dir || ';'
  143. call SysCreateObject classname, title, location, setup, 'r'
  144.  
  145.  
  146. /* Create a shadow of the REXX information */
  147.  
  148. x = x + nDeltaX;
  149. classname = 'WPProgram'
  150. title     = 'REXX Information'
  151. location  = '<VXREXX_FOLDER>'
  152. setup     = 'EXENAME=view.exe;' ||,
  153.             'PROGTYPE=PM;' ||,
  154.             'ICONPOS=' x || ',' || y || ';' ||,
  155.             'PARAMETERS=rexx.inf;'
  156.  
  157. call SysCreateObject classname, title, location, setup, 'r'
  158.  
  159. /* Create a Color Palette */
  160.  
  161. x = x + nDeltaX;
  162. classname = 'WPColorPalette'
  163. title     = 'Color Palette'
  164. location  = '<VXREXX_FOLDER>'
  165. setup     = 'ICONPOS=' || x || "," || y || ";"
  166.  
  167. call SysCreateObject classname, title, location, setup, 'r'
  168.  
  169. /* Create a Font Palette */
  170.  
  171. x = x + nDeltaX
  172. classname = 'WPFontPalette'
  173. title     = 'Font Palette'
  174. location  = '<VXREXX_FOLDER>'
  175. setup     = 'ICONPOS=' || x || "," || y || ";"
  176.  
  177. call SysCreateObject classname, title, location, setup, 'r'
  178.  
  179. /* Create the VX REXX program object */
  180.  
  181. x = 5;
  182. y = y + nDeltaY;
  183. classname = 'WPProgram'
  184. title     = 'VX-REXX'
  185. location  = '<VXREXX_FOLDER>'
  186. setup     = 'EXENAME=' || target_dir || '\vrxedit.exe;' ||,
  187.             'PROGTYPE=PM;' ||,
  188.             'ICONPOS=' || x || "," || y || ";" ||,
  189.             'ASSOCFILTER=*.VRP;' ||,
  190.             'ASSOCTYPE=VX-REXX Project;'
  191.  
  192. call SysCreateObject classname, title, location, setup, 'r'
  193.  
  194. /* Create the projects folder */
  195.  
  196. /* Put project template shadow in the directory to be shadowed */
  197.  
  198. classname = 'WPShadow'
  199. title     = 'VX-REXX Project'
  200. location  = target_dir||"\PROJECTS"
  201. setup     = 'SHADOWID=<VXREXX_TEMPLATE>;OBJECTID=<VXREXX_PROJECTS>'
  202.  
  203. call SysCreateObject classname, title, location, setup, 'r'
  204.  
  205. x = x + nDeltaX;
  206. classname = 'WPShadow'
  207. title     = 'Projects'
  208. location  = '<VXREXX_FOLDER>'
  209. setup     = 'SHADOWID=' || target_dir || "\PROJECTS;ICONPOS=" x || "," || y || ";OBJECTID=<VXREXX_PROJ>"
  210.  
  211. call SysCreateObject classname, title, location, setup, 'r'
  212.  
  213. /* Create a shadow of the shared directory */
  214.  
  215. x = x + nDeltaX;
  216. classname = 'WPShadow'
  217. title     = 'Shared'
  218. location  = '<VXREXX_FOLDER>'
  219. setup     = 'SHADOWID=' || target_dir || "\SHARED;ICONPOS=" x || "," || y || ";OBJECTID=<VXREXX_SHARED>"
  220.  
  221. call SysCreateObject classname, title, location, setup, 'r'
  222.  
  223. /* Create the Samples folder */
  224.  
  225. x = x + nDeltaX;
  226. classname = 'WPFolder'
  227. title     = 'Samples'
  228. location  = '<VXREXX_FOLDER>'
  229. setup     = 'ICONPOS=' x || "," || y || ";OBJECTID=<VXREXX_SAMPLES>;"
  230.  
  231. call SysCreateObject classname, title, location, setup, 'r'
  232.  
  233. /* Create the Macros folder */
  234.  
  235. x = x + nDeltaX;
  236. classname = 'WPShadow'
  237. title     = 'Macros'
  238. location  = '<VXREXX_FOLDER>'
  239. setup     = 'SHADOWID=' || target_dir || '\MACROS;ICONPOS=' x || "," || y || ";OBJECTID=<VXREXX_MACROS>;"
  240. call SysCreateObject classname, title, location, setup, 'r'
  241.  
  242. x = x + nDeltaX;
  243. classname = 'WPShadow'
  244. title     = 'Icons'
  245. location  = '<VXREXX_FOLDER>'
  246. setup     = 'SHADOWID=' || target_dir || '\ICONS;ICONPOS=' x || "," || y || ";OBJECTID=<VXREXX_ICONS>;"
  247. call SysCreateObject classname, title, location, setup, 'r'
  248.  
  249. /* Create a Source Folder under Samples */
  250.  
  251. classname = 'WPFolder'
  252. title     = 'Source'
  253. location  = '<VXREXX_SAMPLES>'
  254. setup     = 'OBJECTID=<SAMPLE_SOURCE>'
  255. call SysCreateObject classname, title, location, setup, 'r'
  256.  
  257.  
  258.  
  259. /* Create the VX REXX macro-launcher object */
  260.  
  261. /*
  262.     Don't include this for now.
  263.     Its presence in the VX-REXX folder is confusing.  People click on it and
  264.     expect something to happen.  Nothing does.
  265.  
  266.     We don't really expect people to drag and drop macros, or to rename them *.VRM and
  267.     double click on them.  Macro's are really only run from applications.
  268. */
  269. /*
  270. classname = 'WPProgram'
  271. title     = 'VX-REXX Macro'
  272. location  = '<VXREXX_FOLDER>'
  273. setup     = 'EXENAME=' || target_dir || '\vrx.exe;' ||,
  274.             'PROGTYPE=PM;' ||,
  275.             'ASSOCFILTER=*.VRM;' ||,
  276.             'ASSOCTYPE=VX-REXX Macro;'
  277.  
  278. call SysCreateObject classname, title, location, setup, 'r'
  279. */
  280.  
  281. /*
  282.  * Set the executable icon.
  283.  */
  284. call AddSample "Bounce",    "Bounce",           "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  285. call AddSample "Button",    "Button",           "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  286. call AddSample "Calc",      "Calculator",       "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  287. call AddSample "DDE",       "DDE Explorer",     "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  288. call AddSample "DragDrop",  "DragDrop",         "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  289. call AddSample "FileBro",   "File browser",     "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  290. call AddSample "Focus",     "Hocus focus",      "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  291. call AddSample "HintHelp",  "Hint and Help",    "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  292. call AddSample "MindGame",  "Mind Game",        "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  293. call AddSample "MMW",       "MMW",              "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  294. call AddSample "Movies",    "Movies",           "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  295. call AddSample "Notebook",  "Notebook",         "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  296. call AddSample "Popup",     "Popup",            "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  297. call AddSample "Printing",  "Printing",         "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  298. call AddSample "RGB",       "RGB",              "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  299. call AddSample "Threads",   "Threads",          "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  300. call AddSample "Employee",  "Employee Database",  "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  301. call AddSample "WinCtrl",   "Window Controller","<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  302. call AddSample "Scan", "Scan", "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  303. call AddSample "CUA91", "CUA 91 Skeleton", "<VXREXX_SAMPLES>", "SAMPLES", "<SAMPLE_SOURCE>"
  304.  
  305. exit
  306.  
  307. /* Add templates */
  308.  
  309. AddTemplate:
  310.  
  311.     classname = 'WPFolder'
  312.     title     = 'VX-REXX Project'
  313.     location  = '<WP_TEMPS>'
  314.     setup     = 'OBJECTID=<VXREXX_TEMPLATE>;' ||,
  315.                 'TEMPLATE=yes;'
  316.  
  317.     call SysCreateObject classname, title, location, setup, 'r'
  318.  
  319.     classname = 'WPDataFile'
  320.     title     = 'Project.VRP'
  321.     location  = '<VXREXX_TEMPLATE>'
  322.     setup     = ''
  323.  
  324.     call SysCreateObject classname, title, location, setup, 'r'
  325.  
  326.     classname = 'WPDataFile'
  327.     title     = 'Window1.VRY'
  328.     location  = '<VXREXX_TEMPLATE>'
  329.     setup     = ''
  330.  
  331.     call SysCreateObject classname, title, location, setup, 'r'
  332.  
  333.     classname = 'WPDataFile'
  334.     title     = 'Window1.VRX'
  335.     location  = '<VXREXX_TEMPLATE>'
  336.     setup     = ''
  337.  
  338.     call SysCreateObject classname, title, location, setup, 'r'
  339.  
  340.     return
  341.  
  342.  
  343. AddSample: procedure expose target_dir
  344. /*********
  345.     Parms:  1   directory name
  346.             2   long name
  347.             3   location
  348.             4   sample directory
  349.             5   source folder location
  350.  
  351. */
  352.  
  353.  
  354.    szDirName = arg(1)
  355.    szLongName = arg(2)
  356.    szLocation = arg(3)
  357.    szSampleDir = arg(4)
  358.    szSourceLocation = arg(5)
  359.  
  360.    szStartUp = target_dir || "\" || szSampleDir || "\" || szDirName;
  361.  
  362.    szExeName = szDirName || ".EXE";
  363.    szIcoName = szDirName || ".ICO";
  364.    szVRPName = szDirName || ".VRP";
  365.  
  366. /* Create Shadow of source directory in the sample source folder */
  367.  
  368.    classname = "WPShadow"
  369.    title     = szLongName
  370.    location  = szSourceLocation
  371.    setup     = "SHADOWID=" || szStartUp || ";"
  372.  
  373.    call SysCreateObject classname, title, location, setup, 'r'
  374.  
  375.     if( szDirName = "Scan" ) then do
  376.         /*  Handle case with EPM w/ scan sample 
  377.         */
  378.         classname = "WPProgram"
  379.         title     = "EPM with Scan"
  380.         location  = szLocation
  381.         setup     = "EXENAME=EPM.EXE;PROGTYPE=PM;STARTUPDIR=" || szStartUp || ";PARAMETERS=SCAN.ERX;ICONFILE=" || szStartUp || "\" || szIcoName || ";"
  382.     end
  383.     else do
  384.         /*  Create the executable icon 
  385.         */
  386.         classname = "WPProgram"
  387.         title = szLongName
  388.         location = szLocation
  389.         setup = "EXENAME=" || szStartUp || "\" || szExeName || ";PROGTYPE=PM;ICONFILE=" || szStartUp || "\" || szIcoName || ";STARTUPDIR=" || szStartUp || ";"
  390.     end
  391.     call SysCreateObject classname, title, location, setup, 'r'
  392.  
  393.  
  394.    return
  395.  
  396.  
  397. /*
  398.  * CleanIni -- Clean up the .INI file out of old VX-REXX information.
  399.  *             Cleans up old beta stuff, too.
  400.  */
  401.  
  402. CleanIni:
  403.     call SysIni 'user', 'PMWP_ASSOC_FILTER', '*.VRP', 'DELETE:'
  404.     call SysIni 'user', 'PMWP_ASSOC_TYPE', 'VX-REXX Project', 'DELETE:'
  405.     call SysIni 'user', 'PMWP_ASSOC_TYPE', 'VRx Project', 'DELETE:'
  406.  
  407.     call sysini 'user', 'PM_Workplace:Templates', 'All:', 'ids.'
  408.     do i = 1 to ids.0
  409.         if( pos( 'REXX', ids.i ) \= 0 & pos( 'VX', ids.i ) \= 0 & ,
  410.             pos( 'Project', ids.i ) \= 0 )then do
  411.             call SysIni 'user', 'PM_Workplace:Templates', ids.i, 'DELETE:'
  412.         end
  413.     
  414.         if( pos( 'VRx', ids.i ) \= 0 & pos( 'Project', ids.i ) \= 0 )then do
  415.             call SysIni 'user', 'PM_Workplace:Templates', ids.i, 'DELETE:'
  416.         end
  417.     end
  418.  
  419.     call SysDestroyObject '<VXREXX_SAMPLES>'
  420.     call SysDestroyObject '<VXREXX_TEMPLATE>'
  421.     call SysDestroyObject '<VXREXX_PROJECTS>'
  422.     call SysDestroyObject '<VXREXX_MACROS>'
  423.     call SysDestroyObject '<VXREXX_FOLDER>'
  424.  
  425.     return
  426.     
  427. /*
  428.  * FileExists
  429.  */
  430.     
  431. FileExists:
  432.     return( stream( arg(1), 'c', 'query exists' ) <> '' )
  433.  
  434. /*
  435.  * Usage
  436.  */
  437.  
  438. Usage:
  439.     say ''
  440.     say 'Usage: buildvrx [target_dir] [resolution]'
  441.     say ''
  442.     say '    target_dir   = path where Watcom VX-REXX has been installed'
  443.     say '    resolution   = 640x480, 800x600, 1024x768 where 640x480 is the default'
  444.     say ''
  445.     say 'This program builds/rebuilds the various Workplace Shell objects'
  446.     say 'needed to run WATCOM VX-REXX.'
  447.     exit
  448.