home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 19 Printer / 19-Printer.zip / seikoslp.zip / instSLP.cmd next >
OS/2 REXX Batch file  |  1999-08-11  |  2KB  |  74 lines

  1. /*
  2.  * Install Seiko SLP
  3.  *
  4.  * Author: Bill Schindler
  5.  * Date:   10 August 1999
  6.  *
  7.  * Installs the Seiko Smart Label Printer label layouts into Smack!'s profile.smr.
  8.  */
  9.  
  10. IF LoadRexxUtil() THEN EXIT
  11.  
  12. profile = 'profile.smr'
  13.  
  14. IF Stream(profile, 'C', 'Query Exists') = '' THEN
  15.  DO
  16.   SAY 'Error: "' || profile || '" was not found.'
  17.   SAY
  18.   SAY '  InstSLP.cmd and SeikoSLP.smr should be placed in Smack!''s program'
  19.   SAY '  directory. InstSLP should then be run from Smack!''s program directory.'
  20.   EXIT
  21.  END
  22.  
  23. didInsert = 0
  24. tmp = 'profile.tmp'
  25. CALL SysFileDelete tmp
  26.  
  27. DO i = 1 WHILE Lines(profile) > 0
  28.   line = LineIn(profile)
  29.   IF \ didInsert THEN
  30.    DO
  31.     test = Strip(Space(Translate(line)))
  32.     IF Word(test, 1) = 'CALL' |,
  33.        Pos('LOAD AVERY', test) <> 0 |,
  34.        Pos('DEFINE COLORS', test) <> 0 THEN
  35.      DO
  36.       CALL LineOut tmp, '/* Load Seiko SLP label definitions */'
  37.       CALL LineOut tmp, 'CALL "SeikoSLP.smr"'
  38.       didInsert = 1
  39.      END
  40.    END
  41.   /* Deal with the case where SeikoSLP is already installed */
  42.   test = Strip(Translate(Space(line)))
  43.   IF Pos('SEIKOSLP', test) = 0 &,
  44.      Pos('SEIKO SLP', test) = 0 THEN
  45.    DO
  46.     CALL LineOut tmp, line
  47.    END
  48. END
  49.  
  50. CALL Stream profile, 'C', 'Close'
  51. CALL Stream tmp, 'C', 'Close'
  52.  
  53. CALL SysFileDelete profile
  54. '@ren' tmp profile '> nul'
  55.  
  56. SAY 'Seiko SLP label layouts have been added to Smack!''s profile.'
  57.  
  58. EXIT
  59.  
  60. /*------------------------------------------------------------------------
  61.  * Load RexxUtil
  62.  */
  63. LoadRexxUtil: PROCEDURE
  64.   IF RxFuncQuery('SysLoadFuncs') THEN
  65.     DO
  66.     IF RxFuncAdd('SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs') THEN
  67.       DO
  68.       SAY "Error: Couldn't load RexxUtil library."
  69.       RETURN 1
  70.       END
  71.     CALL SysLoadFuncs
  72.     END
  73.   RETURN 0
  74.