home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE background PUBLIC "-//Apple, Inc.//DTD background V 2.0//EN" "" >
- <background>
- <id>3885</id>
- <filler1>0</filler1>
- <cantDelete> <false /> </cantDelete>
- <showPict> <true /> </showPict>
- <dontSearch> <false /> </dontSearch>
- <link rel="stylesheet" type="text/css" href="stylesheet_3279.css" />
- <part>
- <id>5</id>
- <type>button</type>
- <visible> <true /> </visible>
- <reserved5> 0 </reserved5>
- <reserved4> 0 </reserved4>
- <reserved3> 0 </reserved3>
- <reserved2> 0 </reserved2>
- <reserved1> 0 </reserved1>
- <enabled> <true /> </enabled>
- <rect>
- <left>0</left>
- <top>279</top>
- <right>17</right>
- <bottom>296</bottom>
- </rect>
- <style>opaque</style>
- <showName> <false /> </showName>
- <highlight> <false /> </highlight>
- <autoHighlight> <true /> </autoHighlight>
- <sharedHighlight> <true /> </sharedHighlight>
- <family>0</family>
- <titleWidth>0</titleWidth>
- <icon>29540</icon>
- <textAlign>center</textAlign>
- <font>Chicago</font>
- <textSize>12</textSize>
- <textStyle>plain</textStyle>
- <name>Help</name>
- <script>on mouseUp
- fullhelp
- end mouseUp
-
- on mouseenter
- helper "Click here for more help for HTML Grinder."
- end mouseenter</script>
- </part>
- <name></name>
- <script>on process
- global allfiles
- put cd fld tocpage into tocFile
- put length(cd fld delimiter) into delLong
- put the number of lines in allfiles into numfiles
- get windowscript("Grinding...")
- set thermometer_max of window "Grinding..." to numfiles
- repeat with x = 1 to the number of lines in allfiles
- set the cursor to busy
- put line x of allfiles into thisFile
- put line x-1 of allfiles into prevfile
- put line x+1 of allfiles into nextfile
- --
- --create the links
- if prevfile is not empty and cd fld prevText is not empty then
- put relativepath(thisfile,prevFile) into prevFile
- put "<a href=""e& prevFile "e&">"&cd fld prevtext&"</a>" into prever
- else put empty into prever
- --
- if tocfile is not empty and cd fld returntext is not empty ¬
- and the hilite of cd btn "use table of contents page" is true then
- put relativepath(thisfile,tocFile) into relTocFile
- put "<a href=""e&relTocFile"e&">"&cd fld returnText&"</a>" into toccer
- else put empty into toccer
- --
- if nextfile is not empty and cd fld nextText is not empty then
- put relativepath(thisfile,nextFile) into nextFile
- put "<a href=""e&nextfile"e&">"&cd fld nextText&"</a>" into nexter
- else put empty into nexter
- --
- --format the links
- put "<!--Sequential Linkers-->"&return into addendum
- if prever is not empty
- then put prever&cd fld delimiter after addendum
- if toccer is not empty
- then put toccer&cd fld delimiter after addendum
- if nexter is not empty
- then put nexter&cd fld delimiter after addendum
- repeat dellong times
- delete last char of addendum
- end repeat
- put return&"<!--End of Sequential Linkers-->" after addendum
- --
- --get the old file
- if there is no file thisfile then
- beep
- next repeat
- end if
- open file thisfile
- read from file thisFile until eof
- close file thisfile
- put it into thecontents
- --
- --create the new file
- get search(thecontents,"<!--Sequential Linkers-->",true)
- put item 1 of it into startline
- get search(thecontents,"<!--End of Sequential Linkers-->",true)
- put item 1 of it into endline
- if startline is empty or endline is empty then
- put word 2 of the selectedline of cd btn append into appendo
- if appendo is 1
- then put "0" into chartouche
- else if appendo is 2
- then put length(thecontents) into chartouche
- else if appendo is 3
- then put fulloffset(thecontents,cd fld texto,starter) into chartouche
- else if appendo is 4
- then put fulloffset(thecontents,cd fld texto,ender) into chartouche
- if chartouche is not "error" then
- if appendo is 1
- then put addendum &return&return after char chartouche of thecontents
- else put return&return& addendum &return&return after char chartouche of thecontents
- else put return& addendum after thecontents
- else put addendum into line startline to endline of thecontents
- replacefile thisfile,thecontents
- if iconnum =1
- then put 3 into iconnum
- else put 1 into iconnum
- set thermometer_value of window "grinding..." to x
- set i3_name of window "grinding..." to "grinder"&iconnum
- end repeat
- close window "grinding..."
- alldone
- end process
-
- function fulloffset thecontents,thetext,whichway
- put thecontents into cd fld holding
- find string thetext in cd fld holding
- if the result is not empty then return "ERROR"
- else if whichway is starter
- then return (word 2 of the foundchunk) -1
- else return (word 4 of the foundchunk)
- end fulloffset
-
- on enterkey
- set the hilite of cd btn "link pages" to true
- wait 5
- set the hilite of cd btn "link pages" to false
- send mouseup to cd btn "link pages"
- end enterkey
-
- on converter thefile,thecontents
- put cd fld startTag into thestart
- put cd fld endTag into theEnd
- get search(thecontents,thestart,true)
- if it is empty then exit converter
- put item 1 of it into startline
- get search(thecontents,theEnd,true)
- if it is empty then exit converter
- put item 1 of it into endline
- put thestart&return&cd fld thetext&return&theEnd into replacer
- put replacer into line startline to endline of thecontents
- ReplaceFile thefile,thecontents
- end converter
-
- function lastchar thecontents,tagaware
- put thecontents into cd fld holding
- if tagaware then
- find string "<!--footer-->" in cd fld holding
- if the result is not empty then
- find string "</html>" in cd fld holding
- if the result is not empty
- then put length(cd fld holding) into chunky
- else put (word 2 of the foundchunk)-1 into chunky
- else put (word 2 of the foundchunk)-1 into chunky
- else put length(cd fld holding) into chunky
- put empty into cd fld holding
- return chunky
- end lastchar
-
- function firstchar thecontents,tagaware
- put thecontents into cd fld holding
- if tagaware then
- find string "<body>" in cd fld holding
- if the result is not empty then
- find string "</head>" in cd fld holding
- if the result is not empty then
- find string "</title>" in cd fld holding
- if the result is not empty
- then put "0" into chunky
- else put word 4 of the foundchunk into chunky
- else put word 4 of the foundchunk into chunky
- else put word 4 of the foundchunk into chunky
- else put "0" into chunky
- put empty into cd fld holding
- return chunky
- end firstchar</script>
- </background>
-