home *** CD-ROM | disk | FTP | other *** search
- on writedatafile fileName
- global gfileobj, gtextresult, gresult, lseries, glocalpath
- set the keyDownScript to "noESC"
- set crlf to RETURN & numToChar(10)
- set cs to 1
- set ct to 1
- set cg to 1
- set gfileobj to fileio(mnew, "write", glocalpath & fileName)
- repeat with s = 1 to count(lseries)
- set ls to getAt(lseries, s)
- gfileobj(mwritestring, "SR:" & the pseries of ls & crlf)
- set the text of field "CS" to string(cs)
- set cs to cs + 1
- set ct to 1
- set cg to 1
- repeat with t = 1 to count(the ltitle of ls)
- set lt to getAt(the ltitle of ls, t)
- devidetext(the ptitle of lt)
- gfileobj(mwritestring, "TI:" & gtextresult & crlf)
- devidetext(gresult)
- gfileobj(mwritestring, "TI:" & gtextresult & crlf)
- gfileobj(mwritestring, "TI:" & gresult & numToChar(10))
- set the text of field "CT" to string(ct)
- set ct to ct + 1
- set cg to 1
- repeat with g = 1 to count(the lgroup of lt)
- set ls to getAt(lseries, s)
- set lt to getAt(the ltitle of ls, t)
- set lg to getAt(the lgroup of lt, g)
- gfileobj(mwritestring, "FL:" & the pprotect of lg & the pgroup of lg & the pcheckbox of lg & the pcheck of lg & crlf)
- gfileobj(mwritestring, "BM:" & the pbitmap of lg & crlf)
- set gresult to the pcomment of lg
- repeat while 1
- devidetext(gresult)
- if length(gresult) = 0 then
- gfileobj(mwritestring, "CE:" & gtextresult & crlf)
- exit repeat
- next repeat
- end if
- gfileobj(mwritestring, "CM:" & gtextresult & crlf)
- end repeat
- set the text of field "CG" to string(cg)
- set cg to cg + 1
- end repeat
- end repeat
- end repeat
- gfileobj(mdispose)
- end
-
- on readdatafile fileName
- global glocalpath, gfileobj, gtextresult, gseries, gtitle, gdatafile, gnowseries, gnowtitle, gnowgroup
- set the keyDownScript to "noESC"
- set gnowseries to 0
- set gnowtitle to 0
- set gnowgroup to 0
- set gfileobj to fileio(mnew, "Read", glocalpath & fileName)
- set cs to 1
- set ct to 1
- set cg to 1
- repeat while 1
- set tmp to gfileobj(mreadline)
- set temp to gfileobj(mreadchar)
- set tt to char 1 of tmp & char 2 of tmp
- cuthead(tmp)
- case tt of
- "SR":
- set gseries to gtextresult
- set gnowseries to gnowseries + 1
- add(lseries, birth(script "Series Script"))
- setseries(getAt(lseries, gnowseries), gseries)
- set gnowtitle to 0
- set gnowgroup to 0
- set the text of field "CS" to string(cs)
- set cs to cs + 1
- set ct to 1
- set cg to 1
- "TI":
- set gtitle to gtextresult & RETURN
- set tmp to gfileobj(mreadline)
- set temp to gfileobj(mreadchar)
- cuthead(tmp)
- set gtitle to gtitle & gtextresult & RETURN
- set tmp to gfileobj(mreadline)
- set temp to gfileobj(mreadchar)
- cuthead(tmp)
- set gtitle to gtitle & gtextresult & RETURN
- set gnowtitle to gnowtitle + 1
- set ls to getAt(lseries, gnowseries)
- if gnowtitle > count(the ltitle of ls) then
- addtitle(ls)
- set gnowgroup to 0
- end if
- set lt to getAt(the ltitle of ls, gnowtitle)
- settitle(lt, gtitle)
- set the text of field "CT" to string(ct)
- set ct to ct + 1
- set cg to 1
- "FL":
- set flag to gtextresult
- set cm to EMPTY
- "BM":
- set bitmap to gtextresult
- "CM":
- set cm to cm & gtextresult & RETURN
- "CE":
- set cm to cm & gtextresult & RETURN
- set gnowgroup to gnowgroup + 1
- set ls to getAt(lseries, gnowseries)
- set lt to getAt(the ltitle of ls, gnowtitle)
- if gnowgroup > count(the lgroup of lt) then
- addgroup(lt)
- end if
- set lg to getAt(the lgroup of lt, gnowgroup)
- setgroup(lg, flag, bitmap, cm)
- set the text of field "CG" to string(cg)
- set cg to cg + 1
- otherwise:
- exit repeat
- end case
- end repeat
- gfileobj(mdispose)
- end
-
- on serchfolder path, type
- set filelist to []
- repeat with t = 1 to the maxinteger
- set n to getNthFileNameInFolder(path, t)
- if n = EMPTY then
- exit repeat
- end if
- if n contains type then
- append(filelist, n)
- end if
- end repeat
- return filelist
- end
-
- on deletefile fileName
- set fileobj to fileio(mnew, "Read", fileName)
- fileobj(mdelete)
- end
-
- on copyfile filename1, filename2
- global gfileobj, gfileobj2
- set gfileobj to fileio(mnew, "Read", the pathName & filename1)
- set gfileobj2 to fileio(mnew, "Write", the pathName & filename2)
- set n to gfileobj(mgetlength)
- repeat with t = 1 to n
- gfileobj2(mwritechar, gfileobj(mreadchar))
- end repeat
- end
-