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

  1. /*
  2. @BImprimeAvecOffsets @P @I Ecrit et © par Don Cox juin 1993
  3. @IN'est pas du Domaine Publique. Tous Droits Réservés.
  4. Traduit par Fabien Larini le 1/08/93.
  5.     
  6. Ce Génie permet d'imprimer sur une imprimante matricielle avec des 
  7. origines différentes pour les pages paires et impaires. Le reste des 
  8. données (densité, ...) sont celles courantes lors du lancement du Génie.
  9. */
  10.  
  11.  
  12. /* PrintWithOffsets*/
  13. /*
  14. This genie allows you to print to a "Dot-Matrix" (i.e. non-PostScript) 
  15. printer with different offsets for alternate pages.
  16. Written by Don Cox   June 93. Not Public Domain.
  17. */
  18.  
  19.  
  20. cr = '0a'x
  21. address command
  22. call SafeEndEdit.rexx()
  23. units = ppm_GetUnits()
  24. if units = 3 then call ppm_SetUnits(2)
  25. currentoffset = ppm_GetDMOffset()
  26.  
  27. signal on halt
  28. signal on break_c
  29. signal on break_e
  30. signal on break_d
  31.  
  32. cu = "in"
  33. if units = 2 then cu = "cm"
  34.  
  35. call ppm_AutoUpdate(0)
  36.  
  37. trace n
  38.  
  39. source = ppm_Inform(3,"Données ...","Identiques","Saisissez les","Fichier")
  40.  
  41. totalpages = ppm_Numpages()
  42.  
  43. formstring = ""
  44.  
  45. if source = 0 then do
  46.     if open("temp","ram:offprint.data","R") then do
  47.         formstring = readch("temp",512)
  48.         call close("temp")
  49.         end
  50.     if formstring = "" then source = 1  /* defaults if failed  */
  51.     end   /* source = 0  */
  52.  
  53. if source = 2 then do
  54.     loadfile = ppm_GetFileName("Chargement des Données","","")
  55.     if loadfile = "" then break
  56.     if open("loader",loadfile,"R") then do
  57.         formstring = readch("loader",512)
  58.         call close("loader")
  59.         end
  60.     if formstring = "" then source = 1  /* go for defaults  */
  61.     end
  62.  
  63. if formstring = "" then formstring ="Origine X, p.1 ("cu"):0"||cr"Origine Y, p.1 ("cu"):0"||cr||"Origine X, p.2 ("cu"):0"||cr"Origine Y, p.2 ("cu"):0"||cr"Sauve Données (O/N):N"
  64.  
  65.  
  66. form = ppm_GetForm("Imprime Avec Offsets", 12, formstring)
  67. if form = '' then exit_msg("Abandon")
  68.  
  69. parse var form Xoffset1 '0a'x Yoffset1 '0a'x Xoffset2 '0a'x Yoffset2 '0a'x Saving 
  70.  
  71.  
  72. if Xoffset1 = '' then Xoffset1 = 0
  73. if Yoffset1 = '' then Yoffset1 = 0
  74. if Xoffset2 = '' then Xoffset2 = 0
  75. if Yoffset2 = '' then Yoffset2 = 0
  76. saving = upper(saving)
  77. if saving ~= 'O' then saving = "N"
  78.  
  79. if ~(datatype(Xoffset1, n)) then exit_msg("Saisie Invalide pour Origine X, p.1 : "Xoffset1)
  80. if ~(datatype(Yoffset1, n)) then exit_msg("Saisie Invalide pour Origine Y, p.1 : "Yoffset1)
  81. if ~(datatype(Xoffset2, n)) then exit_msg("Saisie Invalide pour Origine X, p.2 : "Xoffset2)
  82. if ~(datatype(Yoffset2, n)) then exit_msg("Saisie Invalide pour Origine Y, p.2 : "Yoffset2)
  83.  
  84.  
  85. formstring ="Origine X, p.1 ("cu"):"Xoffset1||cr"Origine Y, p.1 ("cu"):"Yoffset1||cr||"Origine X, p.2 ("cu"):"Xoffset2||cr"Origine Y, p.2 ("cu"):"Yoffset2||cr"Sauve Données (O/N):"saving
  86.  
  87.  
  88. if open("temp","ram:offprint.data","W") then do
  89.     call seek("temp",0,"B") 
  90.     call writech("temp",formstring)
  91.     call close("temp")
  92.     end
  93.  
  94. if upper(Saving) = "O" then do
  95.     savefile = ppm_GetFileName("Sauvegarde des Données","","")
  96.     if savefile = "" then break
  97.     if open("saver",savefile,"W") then do
  98.         call writech("saver",formstring)
  99.         call close("saver")
  100.         end
  101.     end
  102.  
  103. do i=1 to totalpages
  104.     call ppm_SetDMOffset(Xoffset1, Yoffset1)
  105.     call ppm_ShowStatus("Impression de la Page "i)
  106.     call ppm_PrintPageDM(i,1,1)
  107.     i=i+1
  108.     if i>totalpages then break
  109.     call ppm_ShowStatus("Impression de la Page "i)
  110.     call ppm_SetDMOffset(Xoffset2, Yoffset2)
  111.     call ppm_PrintPageDM(i,1,1)
  112.     end
  113.  
  114. call ppm_SetDMOffset(word(currentoffset,1), word(currentoffset,2))
  115. call exit_msg("Terminé")
  116.  
  117.  
  118. break_d:
  119. break_e:
  120. break_c:
  121. halt:
  122.     call exit_msg("Arrêt du Génie par l'Utilisateur")
  123.  
  124. exit_msg: procedure  expose units
  125. do
  126.     parse arg message
  127.  
  128.     if message ~= '' then call ppm_Inform(1, message,)
  129.     call ppm_ClearStatus()
  130.     call ppm_SetUnits(units)
  131.     call ppm_AutoUpdate(1)
  132.     exit
  133. end
  134.