home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 July / macformat-039.iso / DATABASE / SHARED.DIR / 01038.ls < prev    next >
Encoding:
Text File  |  1996-03-14  |  2.8 KB  |  95 lines

  1. on GetWideCaptions start
  2.   global tmplist
  3.   set tmplist to []
  4.   set flist to "Filenames"
  5.   set num to the number of lines in field flist
  6.   put "Getting maker numbers..."
  7.   repeat with i = 1 to num
  8.     set tmp to line i of field flist
  9.     if notEmpty(tmp) then
  10.       set mnum to NameToNum(tmp)
  11.       add(tmplist, mnum)
  12.     end if
  13.   end repeat
  14.   set flist to "Filenames2"
  15.   set num to the number of lines in field flist
  16.   repeat with i = 1 to num
  17.     set tmp to line i of field flist
  18.     if notEmpty(tmp) then
  19.       set mnum to NameToNum(tmp)
  20.       add(tmplist, mnum)
  21.     end if
  22.   end repeat
  23.   put tmplist
  24.   set tmpcaptions to EMPTY
  25.   set gArticles to []
  26.   set num to count(tmplist)
  27.   repeat with i = start to num
  28.     set curart to getAt(tmplist, i)
  29.     set tt to line 2 of field (curart && "script")
  30.     do(tt)
  31.     put tt
  32.     put gArticles
  33.     set widecap to the text of field (curart & ".cap-wide")
  34.     set cap to the text of field (curart & ".cap")
  35.     set the itemDelimiter to "@"
  36.     set numchap to count(gArticles)
  37.     set the itemDelimiter to ","
  38.     repeat with j = 1 to numchap
  39.       set the itemDelimiter to "@"
  40.       set chap to item j of cap
  41.       set widechap to item j of widecap
  42.       set the itemDelimiter to "#"
  43.       set numart to count(getAt(gArticles, j))
  44.       set the itemDelimiter to ","
  45.       set tmpchapter to EMPTY
  46.       repeat with k = 1 to numart
  47.         set the itemDelimiter to "#"
  48.         set thinarticle to item k of chap
  49.         set widearticle to item k of widechap
  50.         set the itemDelimiter to ","
  51.         set article to curart & "-" & j & "." & k
  52.         set numarticle to the number of cast article
  53.         put article && numarticle
  54.         set type to getAt(getAt(gArticles, j), k)
  55.         put "type = " && type
  56.         if type contains "pic" then
  57.           if numarticle > 0 then
  58.             if the width of cast numarticle > the height of cast numarticle then
  59.               put "wide!"
  60.               set thinarticle to widearticle
  61.             else
  62.               put "thin!"
  63.             end if
  64.           end if
  65.         else
  66.           if type contains "movie" then
  67.             set thinarticle to widearticle
  68.           end if
  69.         end if
  70.         set the itemDelimiter to "#"
  71.         put thinarticle into item k of tmpchapter
  72.         set the itemDelimiter to ","
  73.       end repeat
  74.       set the itemDelimiter to "@"
  75.       put tmpchapter into item j of tmpcaptions
  76.       set the itemDelimiter to ","
  77.     end repeat
  78.     put tmpcaptions
  79.     put tmpcaptions into field (curart & ".cap-fixed")
  80.   end repeat
  81. end
  82.  
  83. on widefixnames start, end
  84.   repeat with i = start to end
  85.     set tmpname to string(the name of cast i)
  86.     put "0ld " && tmpname
  87.     set the itemDelimiter to "."
  88.     set n to item 1 of tmpname
  89.     set the itemDelimiter to ","
  90.     set tmpname to n & ".cap"
  91.     set the name of cast i to tmpname
  92.     put "new" && tmpname
  93.   end repeat
  94. end
  95.