home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / infob20.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-07-03  |  4KB  |  152 lines

  1. /* Creates WPS objects for InfoBank. */
  2. /* TRACE ALL */
  3.  
  4. FALSE=0;
  5. TRUE=1;
  6.  
  7. CALL rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  8. CALL sysloadfuncs
  9.  
  10. CALL SysCls;
  11. SAY "InfoBank Information Retrieval System Installation Utility."
  12. SAY ""
  13.  
  14. fullpath=Directory()
  15. IF right(fullpath, 1) \= "\" THEN DO
  16.    fullpath = fullpath || "\"
  17. END
  18.  
  19. reply=CheckIfFilesExist(fullpath);
  20. IF \reply THEN DO
  21.    SAY "Couldn't locate the file(s) in '"||fullpath||"'."
  22.    SAY "Please check that the file(s) exist in the directory."
  23.    EXIT
  24. END
  25.  
  26. TryAgain:
  27. SAY
  28. reply = GetYesNo("Do you want to install InfoBank into another directory?")
  29. IF reply THEN DO
  30.    Parse Value SysCurPos() with row col
  31.    SAY "Please enter target directory: ";
  32.    col=col+31
  33.    Call SysCurPos row, col
  34.    PULL newpath;
  35.    IF (newpath="") THEN DO
  36.       SAY "Empty string!"
  37.       SIGNAL TryAgain;
  38.    END
  39.    ELSE IF \(SUBSTR(newpath,2,1)=':') THEN DO
  40.       SAY "You have to specify the full path! E.g. 'C:\InfoBank'."
  41.       SIGNAL TryAgain;
  42.    END
  43.    /* Create the target directory if necessary. */
  44.    result = SysFileTree( Directory, 'Dirs', 'D' )
  45.    IF Dirs.0 = 0 Then
  46.    DO
  47.       result = SysMkDir(newpath)
  48.       IF (result==0) | (result==5) THEN DO
  49.          fullpath=newpath;
  50.          '@COPY InfoBank.* 'fullpath' > NUL'
  51.          '@COPY Setup.* 'fullpath' > NUL'
  52.          '@COPY ReadMe.1st 'fullpath' > NUL'
  53.          '@COPY WHATSNEW.TXT 'fullpath' > NUL'
  54.       END
  55.       ELSE DO
  56.          SAY 'ERROR: Unable to create target directory.'
  57.          EXIT
  58.       END
  59.    END
  60.  
  61. END
  62.  
  63.  
  64. reply = GetYesNo("Do you want to create WPS objects for InfoBank?")
  65. IF reply THEN DO
  66.       CALL SysCreateObject "WPFolder", "InfoBank", "<WP_DESKTOP>", "OBJECTID=<InfoBank>","ReplaceIfExists";
  67.       CALL SysCreateObject 'WPProgram','InfoBank','<InfoBank>','CCVIEW=YES;EXENAME='||fullpath||'\InfoBank.EXE;PROGTYPE=PM'
  68.       CALL SysCreateObject 'WPProgram','InfoBank Setup','<InfoBank>','CCVIEW=YES;EXENAME='||fullpath||'\Setup.EXE;PROGTYPE=PM'
  69.       CALL SysCreateObject 'WPProgram','InfoBank Help','<InfoBank>','CCVIEW=YES;EXENAME=VIEW.EXE;PROGTYPE=PM;PARAMETERS='||fullpath||'InfoBank.INF'
  70.       CALL SysCreateObject 'WPProgram','Setup Help','<InfoBank>','CCVIEW=YES;EXENAME=VIEW.EXE;PROGTYPE=PM;PARAMETERS='||fullpath||'Setup.INF'
  71. END
  72.  
  73. SAY
  74. SAY "Done! Thanks for your interest in InfoBank!"
  75.  
  76. EXIT
  77.  
  78. GetYesNo: procedure
  79.  
  80. SAY arg(1)
  81. PARSE VALUE SysCurPos() WITH row col
  82. curPos= SysCurPos(row-1,LENGTH(arg(1))+1)
  83.  
  84. DO FOREVER
  85.    key=SysGetKey('NoEcho')
  86.    SELECT
  87.       WHEN key='y'|key='Y' THEN
  88.         DO
  89.          SAY key
  90.          return 1       /* True. */
  91.         END
  92.       WHEN key=D2C(13)|key='n'|key='N' THEN
  93.         DO
  94.          SAY key
  95.          return 0       /* False. */
  96.         END
  97.       OTHERWISE
  98.          NOP
  99.    END
  100. END
  101. RETURN
  102.  
  103. CheckIfFilesExist: procedure
  104.    FALSE=0;
  105.    TRUE=1;
  106.  
  107.    fileFound=TRUE;
  108.  
  109.    CALL SysFileTree arg(1) || "InfoBank.EXE", found1, "OF"
  110.    CALL SysFileTree arg(1) || "InfoBank.INF", found2, "OF"
  111.    CALL SysFileTree arg(1) || "Setup.EXE", found3, "OF"
  112.    CALL SysFileTree arg(1) || "Setup.INF", found4, "OF"
  113.    CALL SysFileTree arg(1) || "ReadMe.1st", found5, "OF"
  114.    CALL SysFileTree arg(1) || "WhatsNew.TXT", found6, "OF"
  115.    IF found1.1 = "FOUND1.1" THEN DO
  116.       SAY "Couldn't find InfoBank.EXE."
  117.       fileFound=FALSE;
  118.       END
  119.    IF found2.1 = "FOUND2.1" THEN DO
  120.       SAY "Couldn't find InfoBank.INF."
  121.       fileFound=FALSE;
  122.    END
  123.    IF found3.1 = "FOUND3.1" THEN DO
  124.       SAY "Couldn't find Setup.EXE."
  125.       fileFound=FALSE;
  126.    END
  127.    IF found4.1 = "FOUND4.1" THEN DO
  128.       SAY "Couldn't find Setup.INF."
  129.       fileFound=FALSE;
  130.    END
  131.    IF found5.1 = "FOUND5.1" THEN DO
  132.       SAY "Couldn't find ReadMe.1st."
  133.       fileFound=FALSE;
  134.    END
  135.  
  136.    IF found6.1 = "FOUND6.1" THEN DO
  137.       SAY "Couldn't find WhatsNew.TXT"
  138.       fileFound=FALSE;
  139.    END
  140.  
  141.    RETURN fileFound;
  142.  
  143. CheckPathname: procedure
  144.    /* Verify the directory exists. */
  145.    Result = SysFileTree( arg(1), 'Dirs', 'D' )
  146.    If Dirs.0 = 0 Then Do
  147.       RETURN 0;
  148.    End
  149.  
  150.    RETURN 1; /* Path found. */
  151.  
  152.