Save question
Francis Nugent Dixon
effendi at wanadoo.fr
Mon Apr 23 08:26:13 EDT 2007
Hi from Paris,
I see Chipp and I had the same idea, although I solved it "inline" !
> On Apr 22, 2007, at 10:33 PM, Chipp Walters wrote:
>
>> Joe,
>>
>> I use altArchive, one of my altPlugins, to save iterative copies of my
>> stacks. It saves the original stack as well as a copy of the stack
>> with a serialized suffix (001,002,003) in a folder called "archive" in
My father used to say "If it 'ain't broke, don't fix it !", which in
Revolution, I translate to "If it 'ain't modified, don't save it !"
Hypercard was so good to us !!! UNFORTUNATELY, in Revolution, there
doesn't appear to be a global variable we can
test (a gREV ?) which shows that modifications have been made to your
stack. We are thus forced to save EVERY TIME.
I come from an IBM background in the 70's where "Generation" data files
were all the whizz. We had Gen(0) which
was the latest generation, Gen(-1) which was the Father, etc, etc.
........ When I (like everybody else) had problems
with "Saving my Stack" in Revolution, I solved it like this (see
below) :
My Revolution environment defines a "Revolution" Folder, with a
subfolder for each stack which has a name
which is the name of the stack. Each Stack subfolder has at least a
Backups sub-subfolder, a Program
sub-subfolder, and MAY have other sub-subfolders that I need for that
specific stack (Data, Music, etc.)
(by the way, I use GV prefixes for global variables, LV prefixes for
local variables, and My prefixes for fields)
I have a standard OpenStack routine which fills my pathnames, based
upon the StackName :
As examples, for a stack called FAMILYTREE ........
GVProgramPath is the path to my Program Folder (example -
"/Revolution/FAMILYTREE/Program/")
This is where I store the .rev program file, and help files for the
user.
GVBackupPath is the path to my Backup Folder
"/Revolution/FAMILYTREE/Backups/"
This is where I store the generation backup files for this stack.
MyGenerations is a field on card 1 of my stack, initially empty.
My "closeStack" routines contain the following code (care with line
folding !) :
set the numberFormat to "000"
-- I need three-digit numbers.
if field MyGenerations is empty then put ",,," into field MyGenerations
-- Prime for first time use.
put item 1 of field MyGenerations into LVGen2
-- Pick up Grandfather.
put item 2 of field MyGenerations into LVGen1
-- Pick up Father.
put item 3 of field MyGenerations into LVGen0
-- Pick up Son.
if LVGen0 is empty then put "000" into LVGen0
-- Prime for first time.
put LVGen0 + 1 into LVNewGen0
-- Get next generation number.
put GVBackupPath & "FAMILYTREE-" & LVNewGen0 & ".rev" into LVPathname
save stack "FAMILYTREE" as LVPathName
-- Save the new Son.
put GVBackupPath & "FAMILYTREE-" & LVGen2 & ".rev" into LVDeletePathname
if LVGen2 is not empty then delete file LVDeletePathname
-- Delete the Grandfather.
put LVGen1 & "," & LVGen0 & "," & LVNewGen0 into field MyGenerations
-- Update Grandfather/Father/Son file suffixes.
save stack "FAMILYTREE" as GVProgramPath & "FAMILYTREE.rev"
-- Save normally and recover original stack name.
-Francis
"Nothing should ever be done for the first time !"
More information about the use-livecode
mailing list