/***************************************************************************/
/* Import.rexx   ©1995 Adrian Maggs    2:2500/179.8                        */
/*                                                                         */
/* $VER: Import.rexx 2.3 (12.6.95)                                         */
/*                                                                         */
/* Intended for use from the IMPORT button, will gate any emails etc first */
/***************************************************************************/

options results

spot_path = 'COMMS:Spot/Spot'  /* Change this line */

/* First the gating of emails */

if exists('UUMAIL:Adrian') then do
    address command 'rx rexx:spot/gatemail.rexx >CON:0/0/800/200/gating.../AUTO/CLOSE/SCREENSPOT'
    end 

/* Now any news is gated */

if exists('UUSPOOL:Newsbatch') then do
    address command 'rx rexx:spot/gatemail.rexx >CON:0/0/800/200/gating.../AUTO/CLOSE/SCREENSPOT'
    end             

if ~show('ports','SPOT') then do
  address command spot_path
  'WaitForPort SPOT'
  quit = yes                  /* Marker to close SPOT after finishing */
end

address 'SPOT'
'isiconified'
if rc = 0 then do
  icon = yes                  /* Marker to re-iconify after finishing */
  'uniconify'
end
'spot2front'

'import CLOSEWIN'             /* Import messages */

if icon = yes then do
  'iconify NOREQ'             /* Re-iconify if necessary */
end

if quit = yes then do
  'quitspot NOREQ'            /* Close SPOT if we had to open it ourselves */
end

exit
