/* This script creates a  frame around the selected texts. */
/* © R.Florac, Samedi 28 Mars 1998, version 1.00 */
/* Only normal texts can be used, rotations are not handled */

options results

signal on error
signal on syntax

'FIRSTSEL'; obj=result
if obj=0 then do
    'MESSAGE("No selected text")'
    exit
end

xg=100000; xd = 0; yh = 10000; yb = 0
do while obj>0
    'TYPE('obj')'
    if result ~= 4 then do
	'BLINK('obj')'
	'MESSAGE("Incorrect object type"+CHR(10)+"Only select texts please")'
	exit
    end
    'COORDS('obj')'; coord=result
    PARSE VAR coord x0 ',' y0
    if x0<xg then xg=x0
    if y0>yb then yb=y0
    'WIDTH('obj')'; x0=x0+result
    if x0>xd then xd=x0
    'HEIGHT('obj')'; y0=y0-result
    if y0<yh then yh=y0
    'NEXTSEL('obj')'; obj=result
end
xg=xg-4; xd=xd+6; yh=yh; yb=yb+3
'DRAWMODE(1):MARK(DRAW('xg','yh','xd','yh')):MARK(DRAW('xg','yh','xg','yb')):DRAWMODE(2):MARK(DRAW('xd','yh'+1,'xd','yb')):MARK(DRAW('xg'+1,'yb','xd','yb')):MENU("Group")'
exit

/* Traitement des erreurs, interruption du programme */
syntax:
erreur=RC
'MESSAGE("Script TextFrame"+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
exit

error:
'MESSAGE("Script TextFrame"+"Error in line 'SIGL'")'
exit
