home *** CD-ROM | disk | FTP | other *** search
/ Amiga Times / AmigaTimes.iso / programme / Fiasco_2.2 / ARexx / dummy.frx < prev    next >
Encoding:
Text File  |  1998-10-06  |  2.4 KB  |  130 lines

  1. /* dummy.frx
  2.  * Skeleton script that can be used as base for ARexx scripts
  3.  * Copyright © 1997-1998 Nils Bandener
  4.  * $VER: dummy_frx 6.9 (3.8.98)
  5.  */
  6.  
  7. /* Please specify here a name for the ARexx script:
  8.  */
  9.  
  10. scriptname = "Dummy Script"
  11.  
  12. Options Results
  13.  
  14. /*
  15.  *  If not called from Fiasco, try to address the active
  16.  *  Fiasco project
  17.  */
  18.  
  19. if ~abbrev(address(), "FIASCO.") then
  20. do
  21.     /* Get list of all available ports */
  22.  
  23.     ports = show("Ports")
  24.  
  25.     /* Search for a port of Fiasco */
  26.  
  27.     do i = 1 to words(ports)
  28.  
  29.         if abbrev(word(ports, i), "FIASCO.") then
  30.         do
  31.             /* A port of Fiasco has been found.
  32.              * Now query Fiasco to return the port
  33.              * name of the active database.
  34.              */
  35.  
  36.             Address Value word(ports, i)
  37.  
  38.             GetAttr Project Name Active ARexx
  39.  
  40.             /* This command may fail when
  41.              * no projects are active. This is
  42.              * for example the case, when all
  43.              * projects are hidden.
  44.              */
  45.  
  46.             if rc == 0 then
  47.             do
  48.                 Address Value Result
  49.             end
  50.             else
  51.             do
  52.                 RequestChoice '"No active project" "Cancel" Title "' || scriptname || '"'
  53.  
  54.                 call bail_out
  55.             end
  56.  
  57.             break
  58.         end
  59.     end
  60. end
  61.  
  62. fiasco_port = address()
  63.  
  64. Signal on Syntax
  65. Signal on Halt
  66. Signal on Break_C
  67. Signal on Failure
  68.  
  69. /* This script runs while the user cannot do anything
  70.  * in Fiasco's GUI
  71.  */
  72.  
  73. LockGUI
  74.  
  75.  
  76. /* Code of own scripts must be inserted here.
  77.  * To exit the script, you may directly fall through to bail_out
  78.  * or call it directly.
  79.  * IMPORTANT: Be sure that bail_out is executed! Otherwise,
  80.  * the user will be locked out of Fiasco.
  81.  */
  82.  
  83.  
  84. bail_out:
  85.  
  86. Address Value fiasco_port
  87.  
  88. UnlockGUI
  89. ResetStatus
  90.  
  91. exit
  92.  
  93. syntax:
  94. failure:
  95.  
  96. if show("Ports", fiasco_port) then
  97. do
  98.     Address Value fiasco_port
  99.  
  100.     RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
  101. end
  102. else
  103. do
  104.     say "Error" rc "in line" sigl ":" errortext(rc)
  105.     say "Enter to continue"
  106.     pull dummy
  107. end
  108.  
  109. call bail_out
  110.  
  111. halt:
  112. break_c:
  113.  
  114. if show("Ports", fiasco_port) then
  115. do
  116.     Address Value fiasco_port
  117.  
  118.     RequestChoice '"Script Abort Requested" "Abort Script" Title "' || scriptname || '"'
  119. end
  120. else
  121. do
  122.     say "*** Break"
  123.     say "Enter to continue"
  124.     pull dummy
  125. end
  126.  
  127. call bail_out
  128.  
  129.  
  130.