/*

    $VER: Filer.intui 1.0 (27.8.95)

   Author:
    Matthias Scheler <tron@lyssa.owl.de>

   Function:
    Handles the file attached to a message with Filer.

   History:
    0.1   initial version
    0.2   uses new "EXEC" command
    1.0   released with IntuiNews 1.3

   Requires:
    UMSServer 11.28 or newer
    ums.library 11.18 or newer
    Filer 3.20 or newer

   Example for "ums.config":
    ( IntuiNews.Rexx
	...
        "#?Message F2 Filer.intui\n"
	...
    )

*/

/* Get TEMPORARY filename. */

OPTIONS RESULTS

GETTEMPFILENAME
IF RESULT="RESULT" THEN EXIT 5
TempFileName=RESULT

/* Check wether Filer is running. */

IF ~SHOW('Ports','FilerRexx') THEN
 DO
  'EXEC Run >NIL: Filer >NIL:'
  'EXEC SYS:Rexxc/WaitForPort FilerRexx'

  IF ~SHOW('Ports','FilerRexx') THEN EXIT 10
 END

/* Load directory and select file. */

P=LASTPOS("/",FileName)
IF P=0 THEN
 DO
  P=POS(":",TempFileName)
  Dirname=LEFT(TempFileName,P)
  Filename=SUBSTR(TempFileName,P+1)
 END
ELSE
 DO
  Dirname=LEFT(TempFileName,P-1)
  Filename=SUBSTR(TempFileName,P+1)
 END

ADDRESS 'FilerRexx'
'READSOURCEDIR' Dirname
'SELECTENTRY' Filename

/* Let the action begin. */

ACTION
