Auto save on close stack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Auto save on close stack
How can I have a stack save itself everytime it closes without a user dialog? Is there a preCloseStack message or something similar?
Thanks,
Thanks,
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013
Hi Alex,
omit the "pre" and you are done
Add these lines to your closestack handler, that will do the trick:
Best
Klaus
omit the "pre" and you are done

Add these lines to your closestack handler, that will do the trick:
Code: Select all
on closestack
save this stack
end closestack
Klaus
Save prompt comes before the closeStack message is sent
Klaus,
I am prompted to save the stack before the closeStack message handler has a chance to do anything.
Any other ideas?
I am prompted to save the stack before the closeStack message handler has a chance to do anything.
Any other ideas?
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013
I wondered about that
Thanks. I'll setup a machine to test that. Does it work the same if the person is using Revolution Player?
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013
Hi,
I would recommend using closeStackRequest instead of closeStack. In the closeStackRequest handler, you still have the possibility to cancel the close "message". For example:
You might want to replace the quit command with this handler. Just make sure to just it in case you don't use MySQL or if there are any other libraries and externals that need to be stopped before quitting.
If you open the stack as modeless inside the IDE, the IDE won't ask you whether to save it and the only messages would be those from the script above.
Best,
Mark
I would recommend using closeStackRequest instead of closeStack. In the closeStackRequest handler, you still have the possibility to cancel the close "message". For example:
Code: Select all
on closeStackRequest
-- you might remove the line below, the next line and the
-- last line if you want to auto-save without asking the user
answer "Really?" with "Yes" or "No"
if it is "Yes" then
save this stack
if the result is empty then
lock messages
-- do any additional cleaning up here
if the environment contains "dev" then
close this stack
else
quit
end if
else
beep
answer "Could not save. Want to close anyway?" with "Yes" or "No"
if it is "Yes" then
lock messages
-- do any additional cleaning up here
if the environment contains "dev" then
close this stack
else
quit
end if
end if
end if
end if
end closeStackRequest
If you open the stack as modeless inside the IDE, the IDE won't ask you whether to save it and the only messages would be those from the script above.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode