@IN'est pas du Domaine Publique. Tous Droits Réservés.
Traduit par Fabien Larini le 17/07/93.
Ce Génie nomme toutes les boîtes du document. Le numéro de la boîte est
ajouté à son nom. Les noms existant ne sont modifiée que par l'ajout du
numéro de la boîte.
*/
/* Boxes Name All
This genie gives a name to all the boxes in the document. The box number is added to the end of the name. Existing names are not altered, except for having the number added.
Written by Don Cox July 92 */
trace n
signal on error
signal on syntax
call ppm_AutoUpdate(0)
cr = "0a"x
address command
call SafeEndEdit.rexx()
call ppm_ShowStatus("Nomme les Boîtes ...")
thispage = ppm_CurrentPage()
pages = ppm_NumPages()
do p = 1 to pages
newpage = ppm_GoToPage(p)
totalboxes = ppm_NumBoxes(newpage)
box = ppm_PageFirstBox()
do i = 1 to totalboxes
number = right(ppm_BoxNum(box),3,"0")
info = ppm_GetBoxInfo(box)
boxtype = word(info,1)
boxname = createboxname(box)
call ppm_SetBoxName(box, boxname)
box = ppm_PageNextBox(box)
end
end
call ppm_GoToPage(thispage)
exit_msg("Toutes les Boîtes sont Nomées")
error:
syntax:
do
exit_msg("Arrêt du Génie dû à l'erreur: "errortext(rc))
end
exit_msg:
do
parse arg message
if message ~= "" then
call ppm_Inform(1,message,)
call ppm_ClearStatus()
call ppm_AutoUpdate(1)
exit
end
createboxname: procedure
parse arg box
number = right(ppm_BoxNum(box),3,"0")
info = ppm_GetBoxInfo(box)
boxtype = word(info,1)
boxname = ppm_GetBoxName(box)
if upper(left(boxname,5))="VIDE" then boxname = ""
numbered = 0
if boxname ~="" then do
endbit = right(boxname,5)
if verify(endbit,"()0123456789")=0 then numbered = 1
end
select
when upper(boxtype) = "TEXTE" then do
boxtext = ppm_GetBoxText(box,0)
shorttext = substr(boxtext,1,16)
shorttext = '"'||shorttext||'"'
if boxname = "" then boxname = shorttext
end
when upper(boxtype) = "BITMAP" then do
filename = word(info,5)
endofpath = lastpos("/",filename)
if endofpath = 0 then endofpath = pos(":",filename)
filename = substr(filename, endofpath+1)
if boxname = "" then boxname = filename
end
when upper(boxtype) = "EPSF" then do
filename = word(info,3)
endofpath = lastpos("/",filename)
if endofpath = 0 then endofpath = pos(":",filename)
filename = substr(filename, endofpath+1)
if boxname = "" then boxname = filename
end
when upper(boxtype) = "CLIP" then do
objects = "Clip, "||word(info,2)||" objets"
if word(info,2)=1 then objects = "Clip, 1 objet"
if boxname = "" then boxname = objects
end
when upper(boxtype) = "VECTORISÉ" then do
objects = "Aegis, "||word(info,2)||" objets"
if word(info,2)=1 then objects = "Aegis, 1 objet"
if boxname = "" then boxname = objects
end
when upper(boxtype) = "VIDE" then do
if boxname = "" then boxname = "Vide"
end
otherwise boxname = "Type de Boîte Inconnu"
end
if numbered = 0 then boxname = boxname||" ("number")"