home *** CD-ROM | disk | FTP | other *** search
- on parsePrint startCast
- global gFileIn, gScreen
- set gFileIn to new(xtra("fileio"))
- set fname to displayOpen(gFileIn)
- openFile(gFileIn, fname, 1)
- if not objectp(gFileIn) then
- exit
- end if
- set the itemDelimiter to " "
- set castline to 1
- set currentCast to 1
- repeat while 1
- set LineIn to readLine(gFileIn)
- if LineIn = EMPTY then
- exit repeat
- end if
- set LineOut to parseLine(LineIn)
- put LineOut into line castline of field currentCast of castLib "Recipe Text Files"
- delete line 2 of field currentCast of castLib "Recipe Text Files"
- put currentCast
- set currentCast to currentCast + 1
- end repeat
- put "ALL DONE! ALEX IS A CHEESEBALL!"
- set gFileIn to EMPTY
- end
-
- on combineLists someText, aMember
- if someText = EMPTY then
- exit
- end if
- if the castType of member aMember of castLib "database" = #text then
- set originalText to the text of member aMember of castLib "database"
- put "combining " & the number of lines in originalText & " of original text"
- repeat with i = 1 to the number of lines in originalText
- set originalLine to line i of originalText
- if originalLine > EMPTY then
- put originalLine into line i of someText
- end if
- end repeat
- end if
- put someText into field aMember of castLib "database"
- put "Just wrote " && the number of lines in someText && "lines in cast " && aMember
- end
-
- on parseLine theLine
- set save to the itemDelimiter
- set the itemDelimiter to TAB
- set n to the number of items in theLine
- set newLine to item 1 of theLine
- repeat with i = 2 to n
- set aChunk to item i of theLine
- if (aChunk > EMPTY) and (aChunk <> RETURN) then
- set token to char 1 to 4 of aChunk
- if (token = "#VID") or (token = "#PIC") or (aChunk contains "Δí") then
- delete char 1 to 5 of aChunk
- set newTok to parseToken(value(aChunk))
- set aChunk to token & "/" & newTok
- end if
- put "," & aChunk after newLine
- end if
- end repeat
- set the itemDelimiter to save
- return newLine
- end
-
- on parseToken dataname
- global gScreen
- if listp(dataname) then
- set datalist to dataname
- repeat with listitem = 1 to count(datalist)
- set dataname to getAt(datalist, listitem)
- setAt(datalist, listitem, value(string(parseToken(dataname))))
- end repeat
- return value(string(datalist))
- else
- if char 1 of string(dataname) = "Δí" then
- delete char 1 of dataname
- end if
- set m to the number of member dataname
- if m > 0 then
- return the memberNum of member dataname
- else
- if dataname <> 0 then
- put "Bad name:" && dataname && "on screen" && gScreen
- end if
- return 0
- end if
- end if
- end
-