Quoting between substacks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Quoting between substacks
Someone wanting to prove that the engine can handle it. Not really useful in general. One use case to allowing it from disk would be allowing someone to open two “Untitled 1” stacks and rename them without having to jump through hoops.
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Quoting between substacks
Do you imagine I took the time to post the steps above merely randomly?
Did you try it?
True, when dealing with the well-known stack name conflicts introduced by the IDE, it's possible to come up with an edge case that doesn't work. Similarly, the computer must be turned on. And the computer must have a functioning file system installed. We could probably come up with a long list of edge cases if we choose to spend our time that way. I have a habit of focusing on practical solutions, which puts me at a disadvantage in such pursuits. I generally don't choose stack names that I don't want.Make a new stack (="Untitled 1") with one field and save it as </path/to/file/a.livecode>.
Then restart LC and make a new stack (="Untitled 1") with a button. Button's script:... Your rule doesn't apply for that scenario here.Code: Select all
on mouseUp put 1 into fld 1 of card 1 of stack </path/to/file/a.livecode> end mouseUp
If you work on a team that puts stacks into production with the name "Untitled 1" there are bigger challenges than needing to change properties in separate stack files without triggering the open* messages.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Quoting between substacks
Thank you for clarifications.
I have now tried and experimented without succes.
Briefly: 2 substacks:
a) "Phenomenalog", accumulating daycards, with textfield, for users diary notes
b) "Parsings" with two fields : i) "searching" & ii) "occurrences"
The handler "phenoparse" is placed in the script of stack "Phenomenalog".
It shall permit user to specify a search-term and perform an automatic scanning the texts of all daycards & quote all lines where the specified word(s) /name/number appears.
I attach the script of the handler in the hope that someone can suggest how to repair it.
------------------
on phenoparse
global phenodate,cue,start,hitcard
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
open stack "Parsings"
new card
open field "searchings"
put "Parsed for" && cue && phenodate after field "searchings"of stack "Parsings"
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
-- open field “occurrences” of stack "Parsings"
put "<p>" & start & hitcard &"</p>" into field “occurrences” of last card of stack "Parsings"
put "<p>" & short name of this card & "</p>" into field “occurrences” of last card of stack "Parsings"
-- put the htmltext of line (word 2 of the foundline) - avant to (word 2 of the foundline) + apres of field "Textfield" after field “occurrences” of stack "Parsings"
-- put string cue after field “occurrences”
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
put "<p> ----------------------</p>" after field “occurrences” of stack “Parsings”
put "<p>" & short name of this card & "</p>" after field “occurrences” of stack “Parsings”
end if
put the htmltext of line (word 2 of the foundline) - avant to (word 2 of the foundline) + apres of field "Textfield" after field “occurrences” of stack “Parsings”
end repeat
go last card
put return & phenodate && the time && "Parsed:" && cue after field "TextField"
show stack "Parsings"
end phenoparse
I have now tried and experimented without succes.
Briefly: 2 substacks:
a) "Phenomenalog", accumulating daycards, with textfield, for users diary notes
b) "Parsings" with two fields : i) "searching" & ii) "occurrences"
The handler "phenoparse" is placed in the script of stack "Phenomenalog".
It shall permit user to specify a search-term and perform an automatic scanning the texts of all daycards & quote all lines where the specified word(s) /name/number appears.
I attach the script of the handler in the hope that someone can suggest how to repair it.
------------------
on phenoparse
global phenodate,cue,start,hitcard
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
open stack "Parsings"
new card
open field "searchings"
put "Parsed for" && cue && phenodate after field "searchings"of stack "Parsings"
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
-- open field “occurrences” of stack "Parsings"
put "<p>" & start & hitcard &"</p>" into field “occurrences” of last card of stack "Parsings"
put "<p>" & short name of this card & "</p>" into field “occurrences” of last card of stack "Parsings"
-- put the htmltext of line (word 2 of the foundline) - avant to (word 2 of the foundline) + apres of field "Textfield" after field “occurrences” of stack "Parsings"
-- put string cue after field “occurrences”
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
put "<p> ----------------------</p>" after field “occurrences” of stack “Parsings”
put "<p>" & short name of this card & "</p>" after field “occurrences” of stack “Parsings”
end if
put the htmltext of line (word 2 of the foundline) - avant to (word 2 of the foundline) + apres of field "Textfield" after field “occurrences” of stack “Parsings”
end repeat
go last card
put return & phenodate && the time && "Parsed:" && cue after field "TextField"
show stack "Parsings"
end phenoparse
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Quoting between substacks
Hi,
Please, please frame code offerings within the code tags (</>). It makes it much easier to see what is going on.
I glanced at your handler. Is this correct?
See the line properly "tagged"? And does this make sense?
Craig
Please, please frame code offerings within the code tags (</>). It makes it much easier to see what is going on.
I glanced at your handler. Is this correct?
Code: Select all
if short name of this card && the foundchunk is start then
Craig