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

  1. /* copyarc.frx
  2.  * Copyright © 1997 Nils Bandener
  3.  * $VER: copyarc_frx 6.3 (7.10.97)
  4.  */
  5.  
  6. scriptname = "Copy Archive"
  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.         signal off failure
  69.  
  70.         'copy "' || Archive || '" to "' || dest || '"'
  71.  
  72.         if rc ~= 0 then
  73.         do
  74.             Address Value fiasco_port
  75.  
  76.             RequestChoice '"Error copying archive" "Cancel" Title "Copy Archive"'
  77.         end
  78.     end
  79. end
  80. else
  81. do
  82.     RequestChoice '"No record active" "Cancel" Title "Copy Archive"'
  83. end
  84.  
  85. bail_out:
  86.  
  87. Address Value fiasco_port
  88.  
  89. UnlockGUI
  90. ResetStatus
  91.  
  92. exit
  93.  
  94. syntax:
  95. failure:
  96.  
  97. if show("Ports", fiasco_port) then
  98. do
  99.     Address Value fiasco_port
  100.  
  101.     RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
  102. end
  103. else
  104. do
  105.     say "Error" rc "in line" sigl ":" errortext(rc)
  106.     say "Enter to continue"
  107.     pull dummy
  108. end
  109.  
  110. call bail_out
  111.  
  112. halt:
  113. break_c:
  114.  
  115. if show("Ports", fiasco_port) then
  116. do
  117.     Address Value fiasco_port
  118.  
  119.     RequestChoice '"Script Abort Requested" "Abort Script" Title "' || scriptname || '"'
  120. end
  121. else
  122. do
  123.     say "*** Break"
  124.     say "Enter to continue"
  125.     pull dummy
  126. end
  127.  
  128. call bail_out
  129.  
  130.  
  131.  
  132.