home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d925 / donsgenies.lha / DonsGenies / FrenchGenies.lha / Rexx / NommeToutesLesBoîtes.pprx < prev    next >
Text File  |  1993-08-03  |  3KB  |  116 lines

  1. /*
  2. @BNommeToutesLesBoîtes @P @I Ecrit et © par Don Cox en juillet 1992
  3. @IN'est pas du Domaine Publique. Tous Droits Réservés.
  4. Traduit par Fabien Larini le 17/07/93.
  5.  
  6. Ce Génie nomme toutes les boîtes du document. Le numéro de la boîte est
  7. ajouté à son nom. Les noms existant ne sont modifiée que par l'ajout du
  8. numéro de la boîte.
  9. */
  10.  
  11. /* Boxes Name All
  12. 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.
  13. Written by Don Cox    July 92  */
  14.  
  15. trace n
  16.  
  17. signal on error
  18. signal on syntax
  19. call ppm_AutoUpdate(0)
  20. cr = "0a"x
  21.  
  22. address command
  23. call SafeEndEdit.rexx()
  24.  
  25. call ppm_ShowStatus("Nomme les Boîtes ...")
  26. thispage = ppm_CurrentPage()
  27. pages = ppm_NumPages()
  28. do p = 1 to pages
  29.     newpage = ppm_GoToPage(p)
  30.  
  31.     totalboxes = ppm_NumBoxes(newpage)
  32.     box = ppm_PageFirstBox()
  33.     do i = 1 to totalboxes
  34.         number = right(ppm_BoxNum(box),3,"0")
  35.         info = ppm_GetBoxInfo(box)
  36.         boxtype = word(info,1)
  37.         boxname = createboxname(box)
  38.         call ppm_SetBoxName(box, boxname)
  39.         box = ppm_PageNextBox(box)
  40.         end
  41. end
  42. call ppm_GoToPage(thispage)
  43. exit_msg("Toutes les Boîtes sont Nomées")
  44.  
  45. error:
  46. syntax:
  47.     do
  48.     exit_msg("Arrêt du Génie dû à l'erreur: "errortext(rc))
  49.     end
  50.  
  51. exit_msg:
  52.     do
  53.     parse arg message
  54.     if message ~= "" then
  55.     call ppm_Inform(1,message,)
  56.     call ppm_ClearStatus()
  57.     call ppm_AutoUpdate(1)
  58.     exit
  59.     end
  60.  
  61.  
  62. createboxname: procedure
  63. parse arg box
  64. number = right(ppm_BoxNum(box),3,"0")
  65. info = ppm_GetBoxInfo(box)
  66. boxtype = word(info,1)
  67. boxname = ppm_GetBoxName(box)
  68.  
  69. if upper(left(boxname,5))="VIDE" then boxname = ""
  70. numbered = 0
  71. if boxname ~="" then do
  72.     endbit = right(boxname,5)
  73.     if verify(endbit,"()0123456789")=0 then numbered = 1
  74.     end
  75.  
  76. select
  77.     when upper(boxtype) = "TEXTE" then do
  78.         boxtext = ppm_GetBoxText(box,0)
  79.         shorttext = substr(boxtext,1,16)
  80.         shorttext = '"'||shorttext||'"'
  81.         if boxname = "" then boxname = shorttext
  82.         end
  83.     when upper(boxtype) = "BITMAP" then do
  84.         filename = word(info,5)
  85.         endofpath = lastpos("/",filename)
  86.         if endofpath = 0 then endofpath = pos(":",filename)
  87.         filename = substr(filename, endofpath+1)
  88.         if boxname = "" then boxname = filename
  89.         end
  90.     when upper(boxtype) = "EPSF" then do
  91.         filename = word(info,3)
  92.         endofpath = lastpos("/",filename)
  93.         if endofpath = 0 then endofpath = pos(":",filename)
  94.         filename = substr(filename, endofpath+1)
  95.         if boxname = "" then boxname = filename
  96.         end
  97.     when upper(boxtype) = "CLIP" then do
  98.         objects = "Clip, "||word(info,2)||" objets"
  99.         if word(info,2)=1 then objects = "Clip, 1 objet"
  100.         if boxname = "" then boxname = objects
  101.         end
  102.     when upper(boxtype) = "VECTORISÉ" then do
  103.         objects = "Aegis, "||word(info,2)||" objets"
  104.         if word(info,2)=1 then objects = "Aegis, 1 objet"
  105.         if boxname = "" then boxname = objects
  106.         end
  107.     when upper(boxtype) = "VIDE" then do
  108.         if boxname = "" then boxname = "Vide"
  109.         end
  110.     otherwise boxname = "Type de Boîte Inconnu"
  111. end
  112.  
  113. if numbered = 0 then boxname = boxname||" ("number")"
  114.  
  115. return boxname
  116.