Quoting between substacks

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bwmilby
Posts: 439
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Quoting between substacks

Post by bwmilby » Fri Mar 22, 2019 3:20 pm

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

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Quoting between substacks

Post by Klaus » Fri Mar 22, 2019 3:25 pm

Hi Brian,
bwmilby wrote:
Fri Mar 22, 2019 3:20 pm
Someone wanting to prove that the engine can handle it.
that must be Richard G. then! :D

Best

Klaus

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Quoting between substacks

Post by bogs » Fri Mar 22, 2019 4:28 pm

Klaus wrote:
Fri Mar 22, 2019 3:16 pm
Who would want so? :D
Image
Image

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Quoting between substacks

Post by Klaus » Fri Mar 22, 2019 4:31 pm

bogs wrote:
Fri Mar 22, 2019 4:28 pm
Klaus wrote:
Fri Mar 22, 2019 3:16 pm
Who would want so? :D
Image
Except the usual suspects I meant... :D

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9834
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Quoting between substacks

Post by FourthWorld » Fri Mar 22, 2019 8:45 pm

[-hh] wrote:
Fri Mar 22, 2019 2:07 pm
FourthWorld wrote:You can set any property of any object in any stack, even if it's not been explicitly opened.
You didn't try. Did you?
Do you imagine I took the time to post the steps above merely randomly?

Did you try it?
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:

Code: Select all

on mouseUp
  put 1 into fld 1 of card 1 of stack </path/to/file/a.livecode>
end mouseUp
... Your rule doesn't apply for that scenario here.
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.

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

kresten
Posts: 153
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: Quoting between substacks

Post by kresten » Thu Mar 28, 2019 7:50 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9662
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Quoting between substacks

Post by dunbarx » Thu Mar 28, 2019 11:34 pm

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?

Code: Select all

if short name of this card && the foundchunk is start then
See the line properly "tagged"? And does this make sense?

Craig

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”