/***************************************************************************/
/* Export.rexx   ©1993 Stu Churchill   2:250/107.97@fidonet                */
/*                                                                         */
/* $VER: Export.rexx 1.40 (17.9.93)                                        */
/*                                                                         */
/* Intended for use from a cron, to be called before polling for mail.     */
/***************************************************************************/

options results

spot_path = 'Workbench:WBStartup/Spot CONFIGPATH "MAIL:Configs/Spot/"'

if ~show('ports','SPOT') then do
  address command 'run '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'
'export CLOSEWIN'             /* Export messages */

if quit = yes then do
  'quitspot NOREQ'            /* Close SPOT if we had to open it ourselves */
  exit
end
if icon = yes then do
  'iconify NOREQ'             /* Re-iconify if necessary */
end

exit
