home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #3 / amigamamagazinepolishissue1998.iso / bazy / fiasco_2.1 / arexx / print.frx < prev    next >
Text File  |  1997-10-06  |  2KB  |  125 lines

  1. /* print.frx
  2.  * Example script for printing from ARexx
  3.  * Copyright © 1995-1997 Nils Bandener
  4.  * $VER: print.frx 6.2 (22.9.97)
  5.  */
  6.  
  7. scriptname = "Print Example"
  8.  
  9. Options Results
  10.  
  11. /*
  12.  *  If not called from Fiasco, try to address the active
  13.  *  Fiasco project
  14.  */
  15.  
  16. if ~abbrev(address(), "FIASCO.") then
  17. do
  18.     ports = show("Ports")
  19.  
  20.     do i = 1 to words(ports)
  21.  
  22.         if abbrev(word(ports, i), "FIASCO.") then
  23.         do
  24.             Address Value word(ports, i)
  25.  
  26.             GetAttr Project Name Active ARexx
  27.  
  28.             Address Value Result
  29.  
  30.             break
  31.         end
  32.     end
  33. end
  34.  
  35. fiasco_port = address()
  36.  
  37. Signal on Syntax
  38. Signal on Halt
  39. Signal on Break_C
  40. Signal on Failure
  41.  
  42. LockGUI
  43.  
  44. /* This is only an example!
  45.  * In the "real world", you will have to
  46.  * use the correct field IDs
  47.  */
  48.  
  49. GetField "Name"
  50. Name = Result
  51.  
  52. GetField "Vorname"
  53. Vorname = Result
  54.  
  55. GetField "Strasse"
  56. Strasse = Result
  57.  
  58. GetField "Hausnummer"
  59. Hausnr = Result
  60.  
  61. GetField "PLZ"
  62. PLZ = Result
  63.  
  64. GetField "Ort"
  65. Ort = Result
  66.  
  67. if open("f", "prt:", "write") then do
  68.  
  69.     call writeln("f", Vorname || " " || Name)
  70.  
  71.     call writeln("f", Strasse || " " || Hausnr)
  72.  
  73.     call writeln("f", PLZ || " " || Ort)
  74.  
  75.     call writeln("f", x2c(B))   /* Formfeed */
  76.  
  77.     call close("f")
  78.  
  79. end
  80.  
  81. bail_out:
  82.  
  83. Address Value fiasco_port
  84.  
  85. UnlockGUI
  86. ResetStatus
  87.  
  88. exit
  89.  
  90. syntax:
  91. failure:
  92.  
  93. if show("Ports", fiasco_port) then
  94. do
  95.     Address Value fiasco_port
  96.  
  97.     RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
  98. end
  99. else
  100. do
  101.     say "Error" rc "in line" sigl ":" errortext(rc)
  102.     say "Enter to continue"
  103.     pull dummy
  104. end
  105.  
  106. call bail_out
  107.  
  108. halt:
  109. break_c:
  110.  
  111. if show("Ports", fiasco_port) then
  112. do
  113.     Address Value fiasco_port
  114.  
  115.     RequestChoice '"Script Abort Requested" "Abort Script" Title "' || scriptname || '"'
  116. end
  117. else
  118. do
  119.     say "*** Break"
  120.     say "Enter to continue"
  121.     pull dummy
  122. end
  123.  
  124. call bail_out
  125.