wiki:Documentation/ARexxAPI/READINFO

Version 6 (modified by damato, 4 months ago) (diff)

--

Languages:

READINFO

NAME
ReadInfo -- Return information about the attachments of the message in the active Read window. (V2.0)
TEMPLATE
VAR/K,STEM/K
FUNCTION
Returns information about the attachments of the message in the active Read window as set by MAILREAD.
INPUTS
VAR/K - alternative variable to put the results into instead of RESULT
STEM/K - base name used for the stems where the results will be stored
RETURNS
VAR - info returned by the query
<STEM>FILENAME.COUNT - number of parts of the message, excluding the first header block
<STEM>FILENAME.NR - filename of the nth part of the message, where nr is a number between 0 and n-1 (0 = first part after the headers, usually the body of the message)
<STEM>FILETYPE.NR - content type of the nth part of the message, where nr is a number between 0 and n-1 (0 = first part after the headers, usually the body of the message)
<STEM>FILESIZE.NR - size of the nth part of the message, where nr is a number between 0 and n-1 (0 = first part after the headers, usually the body of the message)
<STEM>TEMPFILE.NR - temporary file where the nth part of the message is stored, nr being a number between 0 and n-1 (0 = first part after the headers, usually the body of the message)

RC is set to 10 if no Read window was previously specified as "active" with MAILREAD.

NOTES
No filename is returned for the body of the message.
EXAMPLE
/* Enable result codes */
OPTIONS RESULTS

/* Silently decode the current message */
MAILREAD QUIET

/* Get info about the message */
READINFO STEM ri.

/* Only continue if RC == 0 */
IF RC ~= 0 THEN EXIT

/* Close the window */
READCLOSE

/* Display results */
DO i = 0 TO ri.filename.count-1
   SAY 'Information about part #'i+1
   SAY '  File name: 'ri.filename.i
   SAY '  File type: 'ri.filetype.i
   SAY '  File size: 'ri.filesize.i
   SAY '  Stored in: 'ri.tempfile.i
END
BUGS
The command used to blindly act upon the first Read window opened at any given time; this was changed in V2.4 to require the use of MAILREAD to explicitely mark a window as "active".
SEE ALSO
MAILREAD