save content of field [SOLVED]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: save content of field

Post by Klaus » Sun Dec 19, 2021 2:25 pm

Hm, not really...

Add this line right after save... and tell us what you will read, if at all:

Code: Select all

...
save this stack
answer the result
...

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: save content of field

Post by jacque » Sun Dec 19, 2021 6:21 pm

Where is the script that does the save? If it is in the splash stack then "this stack" might be the splash. Change it to

Code: Select all

save stack "<stackname>" 
See if that works.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: save content of field

Post by Samuele » Sun Dec 19, 2021 10:43 pm

Klaus wrote:
Sun Dec 19, 2021 2:25 pm
Hm, not really...

Add this line right after save... and tell us what you will read, if at all:

Code: Select all

...
save this stack
answer the result
...
the result is blank:
Screenshot 2021-12-19 at 22.42.31.png
Samuele.

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: save content of field

Post by Samuele » Sun Dec 19, 2021 10:44 pm

jacque wrote:
Sun Dec 19, 2021 6:21 pm
Where is the script that does the save?
it's on a button that's on a card that's on the "working" stack :shock:
Samuele.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: save content of field

Post by jacque » Mon Dec 20, 2021 12:16 am

Samuele wrote:
Sun Dec 19, 2021 10:44 pm
jacque wrote:
Sun Dec 19, 2021 6:21 pm
Where is the script that does the save?
it's on a button that's on a card that's on the "working" stack :shock:
I'm having some trouble with "this stack" too in some cases. Try using the actual stack name instead of "this stack".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: save content of field

Post by dunbarx » Mon Dec 20, 2021 1:20 am

What Jacque said:
Try using the actual stack name instead of "this stack".
ALWAYS be explicit, and this applies elsewhere, as, for example in referring to controls. That way it does not matter where you are when you want to do something.

Craig

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: save content of field

Post by Samuele » Sun Jan 02, 2022 5:40 pm

ok thanks to all, now it works, i think that the problem was that i forgot to delete the first script that saved without the splash stack so it put something else in the folder i called in the splash stack and so all the splash stack didn't work.
😌
Samuele.

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: save content of field [SOLVED]

Post by Samuele » Fri Jan 21, 2022 10:23 am

Hi, this is the script in the splash stack and it's creating me a problem on the PC because when it goes to the "working stack" it saves me a copy of the stack in the documents folder of my PC, so sometimes i make changes on that and sometimes i make changes on the original and that creates a problem because then i have 2 stacks of the same project but none of them is entirely upgraded.

Code: Select all

function isBuildingStandalone
   return (the environment is "development" AND there is a stack "revStandaloneProgress" AND the mode of stack "revStandaloneProgress" > 0)
end isBuildingStandalone

on openstack
   if isBuildingStandalone() then
      exit openstack
   end if
   ## Neccessary so all opened stacks can access the inclusions of stack "SPLASH"!
   start using this stack
   
   ## Prepare filenames:
   ## Stack in RESOURCES
   put specialfolderpath("resources") & "/clickMe.livecode" into tSourceStack
   
   ## Stack in DOCUMENTS folder
   put specialfolderpath("documents") & "/clickMe.livecode" into tTargetStack
   
   ## check if we already opened the app = the WORKING stack is already in DOCS folder
   if NOT (there is a stack tTargetStack) then
      
      ## Now copy the stack to the DOCS folder
      put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
   end if
   ## NOW we can open that "new" stack that NOW can be saved
   go stack tTargetStack
   hide stack "SplashSource"
end openstack
thanks!
Samuele.

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: save content of field [SOLVED]

Post by Klaus » Fri Jan 21, 2022 10:51 am

... and it's creating me a problem on the PC because when it goes to the "working stack" it saves me a copy of the stack in the documents folder of my PC...
Well, that was the goal of this 5 pages long thread, wasn't it?
... so sometimes i make changes on that and sometimes i make changes on the original and that creates a problem because then i have 2 stacks of the same project but none of them is entirely upgraded...
This is definitively NOT LCs problem! 8)

I would create the standalone only after I had made all neccessary changes to the original stack.

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: save content of field [SOLVED]

Post by Klaus » Fri Jan 21, 2022 11:04 am

You could also prevent this "problem" via script:

Code: Select all

on openstack
   if isBuildingStandalone() then
      exit openstack
   end if
   ## Neccessary so all opened stacks can access the inclusions of stack "SPLASH"!
   start using this stack
   
   ## Prepare filenames:
   ## Stack in RESOURCES
   put specialfolderpath("resources") & "/clickMe.livecode" into tSourceStack

  ## Only copy in the runtime and NOT while in the IDE:
  if the environment = "development" then
    go stack tTargetStack
    hide stack "SplashSource"
    exit openstack
  end if
   
   ## This will now only be executed in a runtime!
   ## Stack in DOCUMENTS folder
   put specialfolderpath("documents") & "/clickMe.livecode" into tTargetStack
   
   ## check if we already opened the app = the WORKING stack is already in DOCS folder
   if NOT (there is a stack tTargetStack) then
      
      ## Now copy the stack to the DOCS folder
      put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
   end if
   ## NOW we can open that "new" stack that NOW can be saved
   go stack tTargetStack
   hide stack "SplashSource"
end openstack

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: save content of field [SOLVED]

Post by Samuele » Fri Jan 21, 2022 12:38 pm

Thank you!
Samuele.

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: save content of field [SOLVED]

Post by Klaus » Fri Jan 21, 2022 1:40 pm

Instead of opening your "splash" stack, you could also only open your "clickme" stack and work on it! 8)

Post Reply