home *** CD-ROM | disk | FTP | other *** search
/ Spawn Figure Collection / spawn collection cd.iso / setup / data1.cab / Program_Executable_Files / Collection.dir / 00009_File Script.ls < prev    next >
Encoding:
Text File  |  1998-01-19  |  4.7 KB  |  152 lines

  1. on writedatafile fileName
  2.   global gfileobj, gtextresult, gresult, lseries, glocalpath
  3.   set the keyDownScript to "noESC"
  4.   set crlf to RETURN & numToChar(10)
  5.   set cs to 1
  6.   set ct to 1
  7.   set cg to 1
  8.   set gfileobj to fileio(mnew, "write", glocalpath & fileName)
  9.   repeat with s = 1 to count(lseries)
  10.     set ls to getAt(lseries, s)
  11.     gfileobj(mwritestring, "SR:" & the pseries of ls & crlf)
  12.     set the text of field "CS" to string(cs)
  13.     set cs to cs + 1
  14.     set ct to 1
  15.     set cg to 1
  16.     repeat with t = 1 to count(the ltitle of ls)
  17.       set lt to getAt(the ltitle of ls, t)
  18.       devidetext(the ptitle of lt)
  19.       gfileobj(mwritestring, "TI:" & gtextresult & crlf)
  20.       devidetext(gresult)
  21.       gfileobj(mwritestring, "TI:" & gtextresult & crlf)
  22.       gfileobj(mwritestring, "TI:" & gresult & numToChar(10))
  23.       set the text of field "CT" to string(ct)
  24.       set ct to ct + 1
  25.       set cg to 1
  26.       repeat with g = 1 to count(the lgroup of lt)
  27.         set ls to getAt(lseries, s)
  28.         set lt to getAt(the ltitle of ls, t)
  29.         set lg to getAt(the lgroup of lt, g)
  30.         gfileobj(mwritestring, "FL:" & the pprotect of lg & the pgroup of lg & the pcheckbox of lg & the pcheck of lg & crlf)
  31.         gfileobj(mwritestring, "BM:" & the pbitmap of lg & crlf)
  32.         set gresult to the pcomment of lg
  33.         repeat while 1
  34.           devidetext(gresult)
  35.           if length(gresult) = 0 then
  36.             gfileobj(mwritestring, "CE:" & gtextresult & crlf)
  37.             exit repeat
  38.             next repeat
  39.           end if
  40.           gfileobj(mwritestring, "CM:" & gtextresult & crlf)
  41.         end repeat
  42.         set the text of field "CG" to string(cg)
  43.         set cg to cg + 1
  44.       end repeat
  45.     end repeat
  46.   end repeat
  47.   gfileobj(mdispose)
  48. end
  49.  
  50. on readdatafile fileName
  51.   global glocalpath, gfileobj, gtextresult, gseries, gtitle, gdatafile, gnowseries, gnowtitle, gnowgroup
  52.   set the keyDownScript to "noESC"
  53.   set gnowseries to 0
  54.   set gnowtitle to 0
  55.   set gnowgroup to 0
  56.   set gfileobj to fileio(mnew, "Read", glocalpath & fileName)
  57.   set cs to 1
  58.   set ct to 1
  59.   set cg to 1
  60.   repeat while 1
  61.     set tmp to gfileobj(mreadline)
  62.     set temp to gfileobj(mreadchar)
  63.     set tt to char 1 of tmp & char 2 of tmp
  64.     cuthead(tmp)
  65.     case tt of
  66.       "SR":
  67.         set gseries to gtextresult
  68.         set gnowseries to gnowseries + 1
  69.         add(lseries, birth(script "Series Script"))
  70.         setseries(getAt(lseries, gnowseries), gseries)
  71.         set gnowtitle to 0
  72.         set gnowgroup to 0
  73.         set the text of field "CS" to string(cs)
  74.         set cs to cs + 1
  75.         set ct to 1
  76.         set cg to 1
  77.       "TI":
  78.         set gtitle to gtextresult & RETURN
  79.         set tmp to gfileobj(mreadline)
  80.         set temp to gfileobj(mreadchar)
  81.         cuthead(tmp)
  82.         set gtitle to gtitle & gtextresult & RETURN
  83.         set tmp to gfileobj(mreadline)
  84.         set temp to gfileobj(mreadchar)
  85.         cuthead(tmp)
  86.         set gtitle to gtitle & gtextresult & RETURN
  87.         set gnowtitle to gnowtitle + 1
  88.         set ls to getAt(lseries, gnowseries)
  89.         if gnowtitle > count(the ltitle of ls) then
  90.           addtitle(ls)
  91.           set gnowgroup to 0
  92.         end if
  93.         set lt to getAt(the ltitle of ls, gnowtitle)
  94.         settitle(lt, gtitle)
  95.         set the text of field "CT" to string(ct)
  96.         set ct to ct + 1
  97.         set cg to 1
  98.       "FL":
  99.         set flag to gtextresult
  100.         set cm to EMPTY
  101.       "BM":
  102.         set bitmap to gtextresult
  103.       "CM":
  104.         set cm to cm & gtextresult & RETURN
  105.       "CE":
  106.         set cm to cm & gtextresult & RETURN
  107.         set gnowgroup to gnowgroup + 1
  108.         set ls to getAt(lseries, gnowseries)
  109.         set lt to getAt(the ltitle of ls, gnowtitle)
  110.         if gnowgroup > count(the lgroup of lt) then
  111.           addgroup(lt)
  112.         end if
  113.         set lg to getAt(the lgroup of lt, gnowgroup)
  114.         setgroup(lg, flag, bitmap, cm)
  115.         set the text of field "CG" to string(cg)
  116.         set cg to cg + 1
  117.       otherwise:
  118.         exit repeat
  119.     end case
  120.   end repeat
  121.   gfileobj(mdispose)
  122. end
  123.  
  124. on serchfolder path, type
  125.   set filelist to []
  126.   repeat with t = 1 to the maxinteger
  127.     set n to getNthFileNameInFolder(path, t)
  128.     if n = EMPTY then
  129.       exit repeat
  130.     end if
  131.     if n contains type then
  132.       append(filelist, n)
  133.     end if
  134.   end repeat
  135.   return filelist
  136. end
  137.  
  138. on deletefile fileName
  139.   set fileobj to fileio(mnew, "Read", fileName)
  140.   fileobj(mdelete)
  141. end
  142.  
  143. on copyfile filename1, filename2
  144.   global gfileobj, gfileobj2
  145.   set gfileobj to fileio(mnew, "Read", the pathName & filename1)
  146.   set gfileobj2 to fileio(mnew, "Write", the pathName & filename2)
  147.   set n to gfileobj(mgetlength)
  148.   repeat with t = 1 to n
  149.     gfileobj2(mwritechar, gfileobj(mreadchar))
  150.   end repeat
  151. end
  152.