home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games 1996 January / amigagames-cdrom-1996-01.iso / rexx / filertm.rexx < prev    next >
OS/2 REXX Batch file  |  1994-06-09  |  4KB  |  111 lines

  1. /*
  2.     $VER: FilerTM.rexx 1.1 (08.06.94)
  3.  
  4.     Author:
  5.         Michael Böhnisch (billy@uni-paderborn.de)               (mb)
  6.  
  7.     Function:
  8.         Makes FilerCom functionality available to ToolManager® dock icons.
  9.  
  10.     Call:
  11.         FilerTM                 Load Filer if necessary and pop it to front
  12.         FilerTM dir1            Additionally read in source directory dir1
  13.         FilerTM dir1 dir2       Additionally read in both directories
  14.         FilerTM path/file       Read path in source directory then perform
  15.                                 default action to file
  16.  
  17.     History:
  18.         30.05.94    1.0 Initial Release                         (mb)
  19.         06.06.94    1.1 Now allows up to 10 Project/Tool icons
  20.                         to be dropped simultaneously on the TM
  21.                         dock icon.                              (mb)
  22. */
  23.  
  24. PARSE ARG Object.1 Object.2 Object.3 Object.4 Object.5 Object.6 Object.7 Object.8 Object.9 Object.10 .
  25.  
  26. /* -------------------------------------------------------------------- */
  27. /* Start Filer if not already running.                                  */
  28. /* -------------------------------------------------------------------- */
  29.  
  30. IF ~SHOW( 'P', 'FilerRexx' ) THEN DO
  31.  
  32.     ADDRESS COMMAND
  33.  
  34.     'Run >NIL: Filer'
  35.  
  36.     /* ---------------------------------------------------------------- */
  37.     /* Wait up to 50 seconds for Filer's AReXX port, time out if it     */
  38.     /* does not show up after this period.                              */
  39.     /* ---------------------------------------------------------------- */
  40.  
  41.     DO 5 WHILE ~SHOW( 'P', 'FilerRexx' )
  42.         'WaitForPort FilerRexx'
  43.     END
  44.     IF RC = 5 THEN DO
  45.         SAY 'Unable to load Filer'
  46.         EXIT
  47.     END
  48. END
  49.  
  50. /* -------------------------------------------------------------------- */
  51. /* By reaching this point Filer should be up'n running. Pull the screen */
  52. /* to the front and respond to the arguments                            */
  53. /* -------------------------------------------------------------------- */
  54.  
  55. ADDRESS 'FilerRexx'
  56.  
  57. FILERTOFRONT
  58.  
  59. IF Object.1 ~= "" THEN DO           /* Are there any arguments at all?  */
  60.  
  61.     /* ---------------------------------------------------------------- */
  62.     /* Load rexxsupport function host if not already present            */
  63.     /* ---------------------------------------------------------------- */
  64.  
  65.     IF ~SHOW( 'L', 'rexxsupport.library' ) THEN DO
  66.         ADDLIB( 'rexxsupport.library', 0, -30, 0 )
  67.     END
  68.  
  69.     /* ---------------------------------------------------------------- */
  70.     /* Get type of arguments and react depending to the type            */
  71.     /* ---------------------------------------------------------------- */
  72.  
  73.     IF LEFT( STATEF( Object.1 ), 1 ) = 'D' THEN DO
  74.  
  75.         /* ------------------------------------------------------------ */
  76.         /* First argument is a directory                                */
  77.         /* ------------------------------------------------------------ */
  78.  
  79.         READSOURCEDIR Object.1
  80.  
  81.         IF Object2 ~= "" THEN DO
  82.  
  83.             IF LEFT( STATEF( Object.2 ), 1 ) = 'D' THEN DO
  84.  
  85.                 /* ---------------------------------------------------- */
  86.                 /* Second argument valid and is a directory             */
  87.                 /* ---------------------------------------------------- */
  88.  
  89.                 READTARGETDIR Object.2
  90.                 OTHERDIR
  91.             END
  92.  
  93.         END
  94.     END
  95.     ELSE DO
  96.  
  97.         /* ------------------------------------------------------------ */
  98.         /* First argument is a file, ignore other argument(s)           */
  99.         /* ------------------------------------------------------------ */
  100.  
  101.     DO i = 1 TO 10
  102.             IF Object.i ~= "" THEN DO
  103.                 divpos = MAX( LASTPOS( ':', Object.i ), LASTPOS( '/', Object.i ) ) + 1
  104.                 READSOURCEDIR STRIP( LEFT( Object.i, divpos - 1 ), 'T', '/' )
  105.                 SELECTENTRY SUBSTR( Object.i, divpos )
  106.                 ACTION
  107.             END
  108.     END
  109.     END
  110. END
  111.