home *** CD-ROM | disk | FTP | other *** search
/ PC Home 49 / PC_Home_Issue_49.iso / winprogs / childenc / oecdemo / butrfly.dir / 00030.ls < prev    next >
Encoding:
Text File  |  1996-07-24  |  963 b   |  36 lines

  1. on makeIndex keyChar1, keyChar2, keyPos
  2.   global indexText, indexList
  3.   set x to the number of lines in indexText
  4.   cursor(4)
  5.   set theCharNum to 97
  6.   set indexList to EMPTY
  7.   set omitIf to 0
  8.   repeat with n = 1 to x
  9.     if not omitIf = 1 then
  10.       if char 1 of line n of indexText = keyChar1 then
  11.         set startLine to n
  12.         set omitIf to 1
  13.       end if
  14.     end if
  15.     if char 1 of line n of indexText = keyChar2 then
  16.       set endLine to n - 1
  17.       exit repeat
  18.     end if
  19.   end repeat
  20.   put startLine && endLine
  21.   set nextChar to char keyPos of line startLine of indexText
  22.   repeat with k = startLine to endLine
  23.     repeat with n = startLine to endLine
  24.       if char keyPos of line k of indexText = nextChar then
  25.         set t to nextChar & "," & n
  26.         put t & RETURN after indexList
  27.         exit repeat
  28.       end if
  29.     end repeat
  30.     set x to charToNum(nextChar)
  31.     set nextChar to numToChar(x + 1)
  32.   end repeat
  33.   put indexList
  34.   cursor(-1)
  35. end
  36.