home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / MAKESP.ZIP / MAKESP.CMD next >
OS/2 REXX Batch file  |  1992-10-28  |  9KB  |  309 lines

  1. /************************************************
  2.  * CSD disk copy command Written by D. Azzarito *
  3.  *                                              *
  4.  * VERSION 1.12 - 10-28-92                      *
  5.  *                                              *
  6.  * This program will create the OS/2 2.0 CSD    *
  7.  * diskettes from DSK images.  It requires      *
  8.  * LOADDSKF, VREXX, and the XR6055 images       *
  9.  ************************************************/
  10.  
  11. /********************
  12.  * Initialize VREXX *
  13.  ********************/
  14.  
  15. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  16. initcode = VInit()
  17. if initcode = 'ERROR' then signal CLEANUP
  18.  
  19. signal on failure name CLEANUP
  20. signal on halt name CLEANUP
  21. signal on syntax name SYNTERR
  22.  
  23. /*******************************
  24.  * Set the disk counts (number *
  25.  * of disks for each size disk)*
  26.  *******************************/
  27.  
  28. DiskCount.3 = 14
  29. DiskCount.5 = 16
  30.  
  31. /*********************
  32.  * check input parms *
  33.  *********************/
  34.  
  35. ARG DriveA DriveB
  36.  
  37. SELECT
  38.    WHEN DriveA = '5.25' THEN
  39.       DriveASize = '5'
  40.    WHEN DriveA = '3.5' THEN
  41.       DriveASize = '3'
  42.    OTHERWISE
  43.       DriveASize = 'BAD'
  44. END
  45.  
  46. SELECT
  47.    WHEN DriveB = '5.25' THEN
  48.       DriveBSize = '5'
  49.    WHEN DriveB = '3.5' THEN
  50.       DriveBSize = '3'
  51.    OTHERWISE
  52.       DriveBSize = 'BAD'
  53. END
  54.  
  55. /***********************************
  56.  * Pop up error if disk info is bad*
  57.  ***********************************/
  58.  
  59. IF DriveASize = 'BAD' THEN DO
  60.    msg.0 = 6
  61.    msg.1 = 'Invalid drive types specified in parameters.'
  62.    msg.2 = ''
  63.    msg.3 = 'ex: If A: is a 5.25" drive, and B: is a 3.5" drive,'
  64.    msg.4 = '    the parameters to MAKCSD.CMD should be: 5.25 3.5'
  65.    msg.5 = ''
  66.    msg.6 = 'Correct the error and restart.'
  67.  
  68.    call VDialogPos 50, 50
  69.    vrc = VMsgBox('PARAMETER ERROR', msg, 1)
  70.    CALL Vexit
  71.    EXIT -1
  72. END
  73.  
  74. call VDialogPos 80, 80
  75.  
  76. /******************************
  77.  * MAIN LOOP:                 *
  78.  * We stay in this loop until *
  79.  * The user selects CANCEL    *
  80.  ******************************/
  81.  
  82. DO FOREVER
  83.  
  84. /*********************************
  85.  * Ask which drive we should use *
  86.  * for the disk creation         *
  87.  *********************************/
  88.  
  89.    List.0=2
  90.    List.1 = 'Full Set ('DiskCount.DriveAsize' 'DriveA' disks) on A:     '
  91.    List.2 = 'Single disk ('DriveA' disk) on A:'
  92.  
  93.    IF DriveBSize \= 'BAD' THEN DO
  94.       List.0=4
  95.       List.3 = 'Full Set ('DiskCount.DriveBsize' 'DriveB' disks) on B:'
  96.       List.4 = 'Single disk ('DriveB' disk) on B:'
  97.    END
  98.  
  99.    vrc = VRadioBox('Select Service Pack to create', list, 3)
  100.  
  101.    IF vrc \= 'OK' THEN
  102.       LEAVE
  103.  
  104.    SingleDisk = 'NO'
  105.  
  106.    SELECT
  107.       WHEN list.vstring = list.1 THEN DO
  108.          DriveCreate = 'A'
  109.          DriveSizeCreate = DriveASize
  110.       END
  111.       WHEN list.vstring = list.2 THEN DO
  112.          DriveCreate = 'A'
  113.          DriveSizeCreate = DriveASize
  114.          SingleDisk = 'YES'
  115.       END
  116.       WHEN list.vstring = list.3 THEN DO
  117.          DriveCreate = 'B'
  118.          DriveSizeCreate = DriveBSize
  119.       END
  120.       WHEN list.vstring = list.4 THEN DO
  121.          DriveCreate = 'B'
  122.          DriveSizeCreate = DriveBSize
  123.          SingleDisk = 'YES'
  124.       END
  125.  
  126.    END
  127.  
  128. /********************************
  129.  * Process single disk requests *
  130.  ********************************/
  131.  
  132.    IF SingleDisk = 'YES' THEN DO
  133.       DO Temp = 1 TO DiskCount.DriveSizeCreate - 2
  134.          Single.Temp = Right(Temp,2,' ')' - Service Pack Disk 'Temp' of 'DiskCount.DriveSizeCreate - 2
  135.       END
  136.       DO Temp = DiskCount.DriveSizeCreate - 1 TO DiskCount.DriveSizeCreate
  137.          Single.Temp = Right(Temp,2,' ')' - Display Device Drivers Disk '||(-(DiskCount.DriveSizeCreate - Temp - 2))
  138.       END
  139.  
  140.       Single.0 = DiskCount.DriveSizeCreate
  141.  
  142.       vrc = VListBox('Select a Disk and Press OK', Single, 39, 8, 1)
  143.       SingleNum = LEFT(Single.vstring,2)
  144.    END
  145.  
  146. /************************************************************
  147.  * Check to see if the user wants the disks FORMATTED first *
  148.  ************************************************************/
  149.    msg.0 = 2
  150.    msg.1 = 'Would you like the disks FORMATTED'
  151.    msg.2 = 'during the creation process?'
  152.  
  153.    Format = VMsgBox('FORMAT OPTION', msg, 6)
  154.  
  155. /***************************
  156.  * MAIN DISK CREATION LOOP *
  157.  ***************************/
  158.  
  159.    IF SingleDisk = 'YES' THEN
  160.       LoopStart = SingleNum
  161.    ELSE
  162.       LoopStart = 1
  163.  
  164.    DO CurrentDisk = LoopStart TO DiskCount.DriveSizeCreate
  165.  
  166. /**************************************
  167.  * Display message with disk label    *
  168.  * Ask if user wants to make this one *
  169.  **************************************/
  170.  
  171.       msg.0 = 7
  172.       msg.1 = 'Insert disk labelled:'
  173.       msg.2 = ''
  174.       msg.3 = '  IBM OS/2 version 2.0 Service Pack XR06055'
  175.       msg.4 = '  Diskette 'CurrentDisk' of 'DiskCount.DriveSizeCreate - 2
  176.       msg.5 = ''
  177.       msg.6 = '  in drive 'DriveCreate':'
  178.       msg.7 = 'Select OK to create, CANCEL to skip'
  179.  
  180.       IF DiskCount.DriveSizeCreate - CurrentDisk < 2 THEN
  181.          msg.4 = '  Display Device Drivers Disk '||(-(DiskCount.DriveSizeCreate - CurrentDisk - 2))' of 2'
  182.  
  183.       vrc = VMsgBox('Ready to create disk', msg, 3)
  184.  
  185. /**************************************
  186.  * User wants this image.  Let's see  *
  187.  * if the image file exists!          *
  188.  **************************************/
  189.  
  190.       IF vrc = 'OK' THEN DO
  191.          ImageFile = OVERLAY(CurrentDisk,'SPG'DriveSizeCreate'00.DSK',-(LENGTH(CurrentDisk)-7))
  192.          "@DIR " ImageFile" > NUL 2>&1"
  193.  
  194. /************************************
  195.  * TROUBLE!  The image isn't here!  *
  196.  ************************************/
  197.  
  198.          IF rc \= 0 THEN DO
  199.             msg.0 = 1
  200.             msg.1 = 'Image file ['ImageFile'] Not Found!'
  201.             call VMsgBox 'ERROR: File Not Found', msg, 1
  202.             END
  203.  
  204. /**********************************
  205.  * We have image, and are ready!  *
  206.  **********************************/
  207.  
  208.          ELSE DO
  209.             pos.left=0
  210.             pos.bottom=85
  211.             pos.right=55
  212.             pos.top=100
  213.             StatId=VOpenWindow('Service Pack diskette progress','WHITE',pos)
  214.             Call VSetFont StatId,'HELV',14
  215.             YPos = 500
  216.             IF Format = 'YES' THEN DO
  217.  
  218. /***********************************
  219.  * If they wanted FORMAT, we do it!*
  220.  ***********************************/
  221.                Call VSay StatId,15,700,'Formatting Diskette in Drive 'DriveCreate':'
  222.                YPos = 300
  223.                'FORMAT 'DriveCreate': /ONCE /V:'CurrentDisk
  224.             END
  225. /***********************************
  226.  * HERE'S WHERE THE IMAGE IS MADE  *
  227.  ***********************************/
  228.  
  229.             Call VSay StatId,15,YPos,'Creating 'STRIP(msg.4)' in Drive 'DriveCreate':'
  230.             'LOADDSKF 'ImageFile' 'DriveCreate': /Y/Q'
  231.             Call VCloseWindow(StatId)
  232.          END   /* END ELSE (image found) */
  233.       END      /* END if vrc=OK (user wants this image) */
  234.  
  235. /***********************************
  236.  * User doesn't want this image.   *
  237.  * Since VREXX can't ask Y/N/Quit, *
  238.  * we'll see if this is a SKIP, or *
  239.  * a request to ABORT.             *
  240.  ***********************************/
  241.  
  242.       ELSE DO
  243.          msg.0 = 2
  244.          msg.1 = 'Select OK to skip to next disk,'
  245.          msg.2 = 'or CANCEL to abort operation'
  246.          vrc = VMsgBox('Diskette Abort Requested', msg, 3)
  247.          IF vrc = CANCEL THEN LEAVE
  248.       END
  249.  
  250. /***********************************
  251.  * If user only wanted one disk,   *
  252.  * we can get out of town!         *
  253.  ***********************************/
  254.  
  255.    IF SingleDisk = 'YES' Then
  256.       LEAVE
  257.  
  258.    END               /* END CurrentDisk loop */
  259.  
  260. /***********************************
  261.  * When we get here, the current   *
  262.  * request is complete.            *
  263.  ***********************************/
  264.  
  265. msg.0 = 1
  266. msg.1 = 'Service Pack Creation Complete!'
  267. call VMsgBox 'Process Completed', msg, 1
  268.  
  269. END                  /* END Do Forever */
  270.  
  271. /************************
  272.  * Put up an "About Box *
  273.  * before we go         *
  274.  ************************/
  275.  
  276. msg.0 = 10
  277. msg.1 = 'This program creates OS/2 SERVICE PACK diskettes from diskette'
  278. msg.2 = 'images.  This program is written entirely in the REXX language, using '
  279. msg.3 = "Richard Lam's VREXX extensions.  Anyone who wishes to create OS/2 "
  280. msg.4 = '2.0 Service Pack diskettes is granted permission to use MAKESP.'
  281. msg.5 = ''
  282. msg.6 = 'For more information, contact:'
  283. msg.7 = ' Doug Azzarito'
  284. msg.8 = ' Compuserve: 72360,3555'
  285. msg.9 = ' Internet: azzarito@cse.fau.edu'
  286. msg.10 = ' Prodigy: HRTH52A'
  287. vrc = VMsgBox('About the MAKESP Program', msg, 1)
  288.  
  289. /**************************************
  290.  * When we get here, the user said    *
  291.  * he doesn't want to make any more   *
  292.  * service packs.  Clean up and EXIT! *
  293.  **************************************/
  294.  
  295. Call VExit
  296. Exit 0
  297.  
  298. /* end of CMD file */
  299.  
  300. SYNTERR:
  301.    msg.0 = 1
  302.    msg.1 = 'Syntax Error!'
  303.    call VMsgBox 'REXX ERROR', msg, 1
  304.  
  305. CLEANUP:
  306.    call VExit
  307.  
  308. exit -1
  309.