home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fonts 1 / freshfonts1.bin / programs / amiga / pastex / rexx / golded / tex-formblatt.ged < prev    next >
Text File  |  1994-03-22  |  3KB  |  101 lines

  1. /* 
  2.     $VER: TeX-Formblatt V0.96 (20.3.94) Axel Burghardt
  3. */
  4.  
  5. Title = "TeX-Formblatt V0.96"
  6.  
  7. OPTIONS RESULTS                             
  8.  
  9. /* ----------------- Wie wurde GoldEd gestartet? ------------------ */
  10.  
  11. IF (LEFT(ADDRESS(), 6) ~= "GOLDED") THEN address 'GOLDED.1'
  12.  
  13. 'LOCK CURRENT'                              
  14. OPTIONS FAILAT 6
  15. SIGNAL ON SYNTAX                            
  16.  
  17. /* -------------------------- Hauptteil --------------------------- */
  18.  
  19. 'REQUEST BODY="Welches Formblatt soll gewählt werden?" BUTTON="Brief|_Abbrechen" TITLE="'Title'"'
  20. SELECT
  21.   WHEN Result=1 THEN DO
  22.     call Brief Title
  23.   END
  24.   OTHERWISE
  25.     'REQUEST BODY="Abbruch durch Anwender!" TITLE="'Title'"'
  26. END
  27.  
  28. 'UNLOCK'
  29. EXIT 0
  30.  
  31. /* ----------------------- Fehlerbehandlung ----------------------- */
  32.  
  33. SYNTAX:
  34.  
  35. 'REQUEST BODY="Fehler in Zeile' SIGL ':' ERRORTEXT(RC) '"'
  36. 'MARK HIDE'
  37. 'GOTO LINE='SIGL
  38. 'MARK SET'
  39. 'UNLOCK'
  40. EXIT 5
  41.  
  42. /* ------------------------ Brief-Formular ------------------------ */
  43.  
  44. Brief: 
  45. PROCEDURE
  46.   PARSE ARG Title
  47.  
  48.   Formblatt = "TEXT:Formblatt/"
  49.   'REQUEST BODY="Brief speichern unter:" STRING TITLE="'Title'"'
  50.   Dateiname = Result
  51.   'OPEN QUIET NEW NAME="'Dateiname'"'
  52.   'OPEN APPEND NAME="'Formblatt'Brief.TeX"'
  53.   'TEXT T="% Generiert am 'date()','time() 'durch' Title'"'
  54.   'REPLACE CONFIRM=FALSE STRING="Dateiname" BY="'specials(Dateiname)'" NEXT'
  55.  
  56.   call Abfrage("Frau/Herr etc.",'\\',Title)
  57.   call Abfrage("Empfänger",'\\',Title)
  58.   call Abfrage("Special",'\\',Title)
  59.   call Abfrage("Straße",'\\',Title)
  60.   call Abfrage("Wohnort",'',Title)
  61.   call Abfrage("Anrede",'',Title)
  62.   call Abfrage("Schluß",'',Title)
  63. RETURN
  64.  
  65. /* ----------------- Ersetze die Schlüsselwörter ------------------ */
  66.  
  67. Abfrage: PROCEDURE
  68.   PARSE ARG Key,End,Title
  69.   
  70.   'REQUEST BODY="'Key'" STRING TITLE="'Title'"'
  71.   IF RC=0 THEN DO
  72.     Rep = Specials(Result)
  73.     IF Rep~='' THEN Rep = Rep||End
  74.     'REPLACE CONFIRM=FALSE STRING="'Key'" BY="'Rep'" NEXT'
  75.   END
  76. RETURN
  77.  
  78. /* ---------------- Ersetzte Sonderzeichen $&%#_{} ---------------- */
  79.  
  80. Specials: PROCEDURE
  81.   PARSE ARG Text
  82.   Text = Special(Text,'$')
  83.   Text = Special(Text,'&')
  84.   Text = Special(Text,'%')
  85.   Text = Special(Text,'#')
  86.   Text = Special(Text,'_')
  87.   Text = Special(Text,'{')
  88.   Text = Special(Text,'}')
  89. RETURN Text
  90.  
  91. /* --------------------- Ersetzte x durch \x ---------------------- */
  92.  
  93. Special: PROCEDURE
  94.   PARSE ARG Text,Character
  95.   P = -1
  96.   DO UNTIL P = 0
  97.     P = index(Text,Character,P+2)
  98.     IF P > 0 THEN Text = Left(Text,P-1) || '\'Character || Right(Text,Length(Text)-P)
  99.   END 
  100. RETURN Text
  101.