With the help from others, many years ago, a setup was accomplished, where parsing for ocurrences of a word ( or a pictogram) in the accumulating mainstack of daycards were/are placed (and accumulated) in in a seperate folder "Parsings" and then copied into a specific substack "Parseviewer".
I have 2 reasons to avoid the use of the separate "Parsings " Folder : Over years of daily use of my personal diary I have never felt the need to look into its accumulated hundreds of previous parsings.
My other motive is that I want the future downloads of the standalones to be as simple as possible. It will be complicated enough with a folder containing 12 pictogram fonts.
I have experimented the last month to modify the parse handler to deliver its result directly in the parseviewer substack , without a Parsing folder, but all my attempts have failed.
two handlers "phenoparse" and "glyphparse"
Code: Select all
on phenoparse
global phenodate,destination,cue
ask "Which word shall be searched?"
if it is empty then
exit phenoparse
else
put it into cue
end if
ask "How many lines before ?" with "0"
if it is cancel then
exit phenoparse
end if
put it into avant
ask "How many lines after ?" with "0"
if it is cancel then
exit phenoparse
end if
put it into apres
put "Parsed for" && cue && phenodate & ".html" into filename
put the effective filename of this stack into destination
set the itemdelimiter to "/"
delete last item of destination
delete last item of destination
delete last item of destination
open file destination &"/"& parsings &"/"& filename
lock screen
set lockmessages to true
go first card of stack "Phenomenalog"
find string cue in field "TextField"
if the result is "not found" then
answer "Cannot find this word"
exit phenoparse
else
put short name of this card && the foundchunk into start
put short name of this card into hitcard
write "<p>" & short name of this card & "</p>" to file destination & "/" & parsings &"/"& filename
write the htmltext of line (word 2 of the foundline) - avant to (word 2 of the foundline) + apres of field "Textfield" to file destination & "/" & parsings &"/"& filename
end if
repeat
set cursor to busy
find string cue in field "TextField"
if short name of this card && the foundchunk is start then
exit repeat
end if
if short name of this card is not hitcard then
put short name of this card into hitcard
write "<p> ----------------------</p>" to file destination &"/"& parsings &"/"& filename
write "<p>" & short name of this card & "</p>" to file destination & "/" & parsings &"/"& filename
end if
write the htmltext of line (word 2 of the foundline) - avant to (word 2 of the foundline) + apres of field "Textfield" to file destination & "/" & parsings & "/" & filename
end repeat
-- save file filename
close file destination & "/" & parsings & "/" & filename
go last card
put return & phenodate && the time && "Parsed:" && cue after field "TextField"
go stack "Parseviewer"
show stack "Parseviewer"
set the htmltext of field "Showfield" to URL ("file:"& destination & "/" & parsings & "/" & filename)
end phenoparse
Ny
Code: Select all
on glyphparse
global phenodate,searchpattern,fontlist,targetfield,destination,selchunk,tekst
ask "How many lines before ?" with "0"
if it is cancel then
exit glyphparse
end if
put it into avant
ask "How many lines after ?" with "0"
if it is cancel then
exit glyphparse
end if
put it into apres
put searchpattern into tekst
ask "Save parsing as:" with tekst
put it into tekst
repeat with x = 1 to the number of chars of tekst
if the chartonum of char x of tekst = 9 then put "_" into char x of tekst
end repeat
put the effective filename of this stack into destination
set the itemdelimiter to "/"
-- delete last item of destination
-- delete last item of destination
-- delete last item of destination
-- delete last item of destination
delete last item of destination
delete last item of destination
delete last item of destination
put destination & "/" & parsings & "/" & "Parsed_for" & "_" & tekst & ".html" into filename
open file filename
lock screen
set cursor to busy
set lockmessages to true
go first card of stack "Phenomenalog"
put empty into hitcard
repeat until hitcard is not empty
put empty into ffontlist
-- find whole searchpattern in field targetfield
find whole searchpattern in field "Textfield"
if the result is empty then
put word 2 of the foundchunk into fstartchar
put word 4 of the foundchunk into fendchar
put word 7 of the foundchunk into ftargetfield
repeat with y = fstartchar to fendchar
put the textfont of char y of field ftargetfield after ffontlist
end repeat
if fontlist = ffontlist then
put short name of this card && the foundchunk into start
put short name of this card into hitcard
write "<p>" & short name of this card & "</p>" to file filename
write the htmltext of line (word 2 of the foundline) - avant to (word 2 of the foundline) + apres of field "Textfield" to file filename
end if
else next repeat
end repeat
repeat
-- find whole searchpattern in field targetfield
find whole searchpattern in field "Textfield"
if short name of this card && the foundchunk is start then
exit repeat
end if
if the result is empty then
put empty into ffontlist
put word 2 of the foundchunk into fstartchar
put word 4 of the foundchunk into fendchar
put word 7 of the foundchunk into ftargetfield
repeat with y = fstartchar to fendchar
put the textfont of char y of field ftargetfield after ffontlist
end repeat
if fontlist = ffontlist then
if short name of this card is not hitcard then
put short name of this card into hitcard
write "<p> ----------------------</p>" to file filename
write "<p>" & short name of this card & "</p>" to file filename
end if
write the htmltext of line (word 2 of the foundline) - avant to (word 2 of the foundline) + apres of field "Textfield" to file filename
end if
end if
end repeat
close file filename
go last card
put return & phenodate && the time && "Parsed:" && tekst after field "TextField"
go stack "Parseviewer"
set the iconic of stack "Parseviewer" to false
show stack "Parseviewer"
set the htmltext of field "Showfield" to \
URL ("file:" & filename)
set the iconic of stack "Phenomenalog" to true
end glyphparse