/*
** $VER: IE_Import.dopus4 1.0.1 (13/11 Stockholm/Sweden)
** Copyright © 1996 by Patrik M Nydensten 
**
** Imports all selected image files in the SRCE directory into IE.
** Requires Image Engineer 3.0 or higher and DOpus 4.x.
**  Call: (AmigaDOS) c:RX Rexx:IE_Import.dopus4 {Qp}
** Flags: (Output to Window)
*/

options results
lf='0a'x

parse arg portname
if left(portname,5)='DOPUS' then address value portname
else exit

if ~show(ports,'IMAGEENGINEER') then do
 	say 'Could not locate IEs arexx port!'
  exit                 
end                 

status '13 -1'
path = result

say ; say 'Importing images into Image Engineer ...' ; say

do forever

  address value portname

	getnextselected
	image_file = RESULT
  if image_file = 0 then leave

	selectfile '"'image_file'"' '0 1'
  
  address 'IMAGEENGINEER'
  say 'Loading' image_file '...'
  'OPEN' '"'path||image_file'"' 'COLOUR'
  address value portname
  if (RC ~= 0) then say 'Failed to load' image_file 'into IE!'

end  /* end of load loop */

exit
