home *** CD-ROM | disk | FTP | other *** search
/ Amiga Times / AmigaTimes.iso / programme / Fiasco_2.2 / Databases / Aminet / extract.frx < prev    next >
Encoding:
Text File  |  1998-10-06  |  2.2 KB  |  137 lines

  1. /* extract.frx
  2.  * Copyright © 1997 Nils Bandener
  3.  * $VER: extract_frx 6.3 (7.10.97)
  4.  */
  5.  
  6. scriptname = "Extract"
  7.  
  8. Options Results
  9.  
  10. /*
  11.  *  If not called from Fiasco, try to address the active
  12.  *  Fiasco project
  13.  */
  14.  
  15. if ~abbrev(address(), "FIASCO.") then
  16. do
  17.     /* Get list of all available ports */
  18.  
  19.     ports = show("Ports")
  20.  
  21.     /* Search for a port of Fiasco */
  22.  
  23.     do i = 1 to words(ports)
  24.  
  25.         if abbrev(word(ports, i), "FIASCO.") then
  26.         do
  27.             /* A port of Fiasco has been found.
  28.              * Now query Fiasco to return the port
  29.              * name of the active database.
  30.              */
  31.  
  32.             Address Value word(ports, i)
  33.  
  34.             GetAttr Project Name Active ARexx
  35.  
  36.             Address Value Result
  37.  
  38.             break
  39.         end
  40.     end
  41. end
  42.  
  43. fiasco_port = address()
  44.  
  45. Signal on Syntax
  46. Signal on Halt
  47. Signal on Break_C
  48. Signal on Failure
  49.  
  50. LockGUI
  51.  
  52. ActiveRecord
  53.  
  54. if result ~= 0 then
  55. do
  56.     GetField "CD Var CD"
  57.     GetField "Directory Var Dir"
  58.     GetField "Archive Var Arc"
  59.  
  60.     Archive = CD || ":Aminet/" || Dir || "/" || Arc
  61.  
  62.     RequestFile "RAM: DrawersOnly Var dest"
  63.  
  64.     if rc = 0 then
  65.     do
  66.         Address Command
  67.  
  68.         if right(dest, 1) ~= ":" & right(dest, 1) ~= "/" then
  69.         do
  70.             dest = dest || "/"
  71.         end
  72.  
  73.         signal off failure
  74.  
  75.         "lha x" Archive dest
  76.  
  77.         if rc ~= 0 then
  78.         do
  79.             Address Value fiasco_port
  80.  
  81.             RequestChoice '"Error Executing Archiver*nRC: ' || RC ||'" "Cancel" Title "Extract File"'
  82.         end
  83.     end
  84. end
  85. else
  86. do
  87.     RequestChoice '"No record active" "Cancel" Title "Extract Archive"'
  88. end
  89.  
  90. bail_out:
  91.  
  92. Address Value fiasco_port
  93.  
  94. UnlockGUI
  95. ResetStatus
  96.  
  97. exit
  98.  
  99. syntax:
  100. failure:
  101.  
  102. if show("Ports", fiasco_port) then
  103. do
  104.     Address Value fiasco_port
  105.  
  106.     RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
  107. end
  108. else
  109. do
  110.     say "Error" rc "in line" sigl ":" errortext(rc)
  111.     say "Enter to continue"
  112.     pull dummy
  113. end
  114.  
  115. call bail_out
  116.  
  117. halt:
  118. break_c:
  119.  
  120. if show("Ports", fiasco_port) then
  121. do
  122.     Address Value fiasco_port
  123.  
  124.     RequestChoice '"Script Abort Requested" "Abort Script" Title "' || scriptname || '"'
  125. end
  126. else
  127. do
  128.     say "*** Break"
  129.     say "Enter to continue"
  130.     pull dummy
  131. end
  132.  
  133. call bail_out
  134.  
  135.  
  136.  
  137.