home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Demos / Component Software / FileFlex 2.0.3.sit / FileFlex 2.0.3 / Unsupported & Undocumented / RESTGUID / RESTGUID.DIR / 00002.ls < prev    next >
Encoding:
Text File  |  1996-07-23  |  3.1 KB  |  78 lines

  1. on startMovie
  2.   global stateDB, restDB, fullstateDEX, stateDEX, cuisineDEX, specialtyDEX, abbrevstateDEX, restnameDEX
  3.   set DBResult to DBOpenSession()
  4.   if DBResult < 0 then
  5.     alert("Error opening FileFlex session.")
  6.     quit()
  7.   end if
  8.   set stateDBF to the moviePath & "STATES.DBF"
  9.   set restDBF to the moviePath & "RESTDB.DBF"
  10.   set stateDB to DBUse(stateDBF)
  11.   checkFail(stateDB, "Error opening states data file.")
  12.   set restDB to DBUse(restDBF)
  13.   checkFail(restDB, "Error opening restaurants data file.")
  14.   set fullstate to the moviePath & "FULLSTAT.NDX"
  15.   set abbrevstate to the moviePath & "ABBREVST.NDX"
  16.   set state to the moviePath & "BYSTATE.NDX"
  17.   set cuisine to the moviePath & "BYCUIS.NDX"
  18.   set specialty to the moviePath & "BYSPEC.NDX"
  19.   set restname to the moviePath & "RESTNAME.NDX"
  20.   set DBResult to DBSelect(stateDB)
  21.   checkFail(DBResult, "Error selecting state data file.")
  22.   set fullstateDEX to DBUseIndex(fullstate)
  23.   checkFail(fullstateDEX, "Error opening full state index file.")
  24.   set abbrevstateDEX to DBUseIndex(abbrevstate)
  25.   checkFail(abbrevstateDEX, "Error opening state abbreviation index file.")
  26.   set DBResult to DBSelect(restDB)
  27.   checkFail(DBResult, "Error selecting restaurant data file.")
  28.   set stateDEX to DBUseIndex(state)
  29.   checkFail(stateDEX, "Error opening state index file.")
  30.   set cuisineDEX to DBUseIndex(cuisine)
  31.   checkFail(cuisineDEX, "Error opening cuisine index file.")
  32.   set specialtyDEX to DBUseIndex(specialty)
  33.   checkFail(specialtyDEX, "Error opening specialty index file.")
  34.   set restnameDEX to DBUseIndex(restname)
  35.   checkFail(restnameDEX, "Error openint restaurant name index file.")
  36. end
  37.  
  38. on stopMovie
  39.   global stateDB, restDB, fullstateDEX, abbrevstateDEX, stateDEX, cuisineDEX, specialtyDEX, restnameDEX
  40.   set DBResult to DBSelect(stateDB)
  41.   checkFail(DBResult, "Error selecting state data file.")
  42.   set DBResult to DBCloseIndex(fullstateDEX)
  43.   checkFail(DBResult, "Error closing full state index file.")
  44.   set DBResult to DBCloseIndex(abbrevstateDEX)
  45.   checkFail(DBResult, "Error closing state abbreviation index file.")
  46.   set DBResult to DBSelect(restDB)
  47.   checkFail(DBResult, "Error selecting restaurant index file.")
  48.   set DBResult to DBCloseIndex(stateDEX)
  49.   checkFail(DBResult, "Error closing state index file.")
  50.   set DBResult to DBCloseIndex(cuisineDEX)
  51.   checkFail(DBResult, "Error closing cuisine index file.")
  52.   set DBResult to DBCloseIndex(specialtyDEX)
  53.   checkFail(DBResult, "Error closing specialty index file.")
  54.   set DBResult to DBCloseIndex(restnameDEX)
  55.   checkFail(DBResult, "Error closing restaurant name index file.")
  56.   set DBResult to DBClose(stateDB)
  57.   checkFail(DBResult, "Error closing states data file.")
  58.   set DBResult to DBClose(restDB)
  59.   checkFail(DBResult, "Error closing restaurants data file.")
  60.   set DBResult to DBCloseSession()
  61.   if DBResult < 0 then
  62.     alert("Error closing FileFlex session.")
  63.     quit()
  64.   end if
  65. end
  66.  
  67. on checkFail resultCode, alertNote
  68.   if resultCode < 0 then
  69.     alert(alertNote & " [" & string(resultCode) & "]")
  70.     set DBResult to DBCloseSession()
  71.     if DBResult < 0 then
  72.       alert("Error closing FileFlex session.")
  73.       quit()
  74.     end if
  75.     quit()
  76.   end if
  77. end
  78.