home *** CD-ROM | disk | FTP | other *** search
/ Plex 4 / Plex4.mdf / english / wksliste.cmd < prev   
OS/2 REXX Batch file  |  1994-10-23  |  3KB  |  105 lines

  1. /*
  2.     WKSLISTE.CMD  (ENGLISH !)
  3.  
  4.     REXX-Program for viewing files
  5.  
  6.     The viewer is selected from the following database by the
  7.     extension of the file to view.
  8.  
  9.     ***************************************************************
  10.     * The list of used view-programs can bei edited and extended  *
  11.     * with any normal text-editor. For every extension there has  *
  12.     * to be a specific view-program. It is important to change the*
  13.     * total number of viewers/extension in this line:             *
  14.     *       Extension.0 = 14                                      *
  15.     ***************************************************************
  16.  
  17.  
  18.   * Modus /U "UNZIP" : The file is still in a ZIP. First unzip it.
  19.                        and view it afdterwards.
  20.     %2 = d:\path\unzip.exe        The UNZIP-Program
  21.     %3 = d:\path\archive.zip      The ZIP-Archive
  22.     %4 = path/path/filename.ext   The file to be unzipped and viewed (with PATH)
  23.     %5 = d:\temppath\WKS0001.TMP  The TEMPPath-Filename-destination
  24.  
  25.   * Modus /L "LIST" : File is already expanded. List it directly !
  26.     %1 = d:\path\filename.ext
  27.  
  28.  
  29.     (C) 1994 Wolfram Körner, Friedenstraße 5a, 97072 Würzburg.
  30.  
  31. */
  32.  
  33. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  34. call SysLoadFuncs
  35.  
  36. parse arg cmdline                /* Get commandline parameters     */
  37. parse var cmdline Mode cmdline   /* which mode ?    /U or   /L     */
  38. Mode = TRANSLATE(Mode)
  39.  
  40. if Mode = "/U" then do
  41.   parse var cmdline UnzipExe ZIP ZIPFile TEMPFile Rest /* analyze  */
  42. end
  43.  
  44. if Mode = "/L" then do
  45.   parse var cmdline TEMPFile Rest                      /* anylyze   */
  46.   ZIPFile=TEMPFile
  47. end
  48.  
  49. /* ------ The list of extensions and the correct viewers ----------*/
  50.  
  51. Viewer = "e.exe"               /* This is the DEFAULT-viewer */
  52.  
  53. Extension.0 = 14               /* Size of the following list*/
  54.  
  55. Extension.1=".INF"             /* *.INF should be viewed with VIEW.EXE */
  56. Lister.1=     "view.exe"
  57.  
  58. Extension.2=".ICO"             /* *.ICO should be viewed with ICONEDIT.EXE */
  59. Lister.2=     "iconedit.exe"
  60. Extension.3=".BMP"             /* and-so-on.......                       */
  61. Lister.3=     "iconedit.exe"
  62. Extension.4=".MID"
  63. Lister.4=     "mppm.exe"
  64. Extension.5=".WAV"
  65. Lister.5=     "mppm.exe"
  66. Extension.6=".AVI"
  67. Lister.6=     "mppm.exe"
  68. Extension.7=".MET"
  69. Lister.7=     "picview.exe"
  70. Extension.8=".PIF"
  71. Lister.8=     "picview.exe"
  72. Extension.9=".SPL"
  73. Lister.9=     "picview.exe"
  74. Extension.10=".MOD"
  75. Lister.10=     "dmplayer"
  76. Extension.11=".GIF"
  77. Lister.11=     "pmjpeg"
  78. Extension.12=".PCX"
  79. Lister.12=     "pmjpeg"
  80. Extension.13=".TIF"
  81. Lister.13=     "pmjpeg"
  82. Extension.14=".JPG"
  83. Lister.14=     "pmjpeg"
  84.  
  85. /* -------------- Get file from ZIP-archive  (Modus /U )----------- */
  86. /* UNZIP-Options:
  87.                    -j  "Junk Pathnames"
  88.                    -o  "overwrite"
  89.                    -p  "extract to pipe"
  90. */
  91.  
  92. if Mode = "/U" then
  93. UnzipExe "-pjo" ZIP ZIPFile " > " TEMPFile
  94.  
  95. /* -------------- Searchroutine for the correct viewer ---------------- */
  96. ZIPFile = Translate(ZIPFile)   /* Change to UPPERCASE  */
  97.  
  98. do i=1 to Extension.0
  99.   if Extension.i = right(ZIPFile, 4) then
  100.      Viewer=Lister.i
  101. end /* do */
  102.  
  103. /* --------------- Call the correct viewer with the file -------------- */
  104. 'start /f' Viewer TEMPFile
  105.