home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 117 / af117a.adf / archives / af117a1.lzx / Fiasco_2.2 / Databases / PictureDatabase / SearchPicture.frx < prev    next >
Text File  |  1998-09-22  |  2KB  |  107 lines

  1. /* searchpicture.frx
  2.  * Search for a picture name
  3.  * Copyright © 1996-1997 Nils Bandener
  4.  * $VER: searchpicture_frx 6.3 (6.10.97)
  5.  */
  6.  
  7. Options Results
  8. Options FailAt 21
  9.  
  10. scriptname = "Search Picture"
  11. fiasco_port = address()
  12.  
  13. Signal on Syntax
  14. Signal on Halt
  15. Signal on Break_C
  16. Signal on Failure
  17.  
  18. LockGUI
  19.  
  20. /*
  21.  * Constant values
  22.  */
  23.  
  24. DTFieldsInRecord = 8
  25.  
  26. RequestString 'Title "Search for picture" Text "Please enter part of*nfile name to search for"'
  27.  
  28. if rc = 0 then
  29. do
  30.     Pattern = Result
  31.  
  32.     CountRecords
  33.     NumRecs = Result
  34.  
  35.     do i = 1 to NumRecs
  36.  
  37.         do k = 1 to DTFieldsInRecord
  38.  
  39.             GetField "Name_" || k "Record" i
  40.             Cont = Result
  41.  
  42.             if Cont ~= "" then
  43.             do
  44.                 if pos(Pattern, Cont) ~= 0 then
  45.                 do
  46.                     ActiveRecord Record i
  47.  
  48.                     call picinfo.frx(k)
  49.  
  50.                     RequestChoice '"Continue Searching?" "Yes|No" "Search for picture"'
  51.  
  52.                     if result = 0 then halt
  53.                 end
  54.             end
  55.         end
  56.     end
  57. end
  58.  
  59. bail_out:
  60.  
  61. Address Value fiasco_port
  62.  
  63. UnlockGUI
  64. ResetStatus
  65.  
  66. exit
  67.  
  68. syntax:
  69. failure:
  70.  
  71. if show("Ports", fiasco_port) then
  72. do
  73.     Address Value fiasco_port
  74.  
  75.     RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
  76. end
  77. else
  78. do
  79.     say "Error" rc "in line" sigl ":" errortext(rc)
  80.     say "Enter to continue"
  81.     pull dummy
  82. end
  83.  
  84. call bail_out
  85.  
  86. halt:
  87. break_c:
  88.  
  89. if show("Ports", fiasco_port) then
  90. do
  91.     Address Value fiasco_port
  92.  
  93.     RequestChoice '"Script Abort Requested" "Abort Script" Title "' || scriptname || '"'
  94.  
  95.     if result = 0 then return
  96. end
  97. else
  98. do
  99.     say "*** Break"
  100.     say "Enter to continue"
  101.     pull dummy
  102. end
  103.  
  104. call bail_out
  105.  
  106.  
  107.