Stack corrupted never more
Posted: Mon Oct 27, 2014 2:56 pm
Hi,
I want to share this code with you. Place it in your mainstack and you'll have always all version backups in a separate folder:
########CODE#######
on saveStackRequest
put the folder into curfolder #save where are we now
set itemDel to "/"
set the folder to item 1 to -2 of (the effective fileName of this stack)
put item -1 of the filename of this stack into fname #just the name
if (fname & "_vers") is not among the lines of the folders then
create folder (fname & "_vers")
end if
set the folder to (the folder & "/" & fname & "_vers")
put the number of lines of the files into nVers
put URL ( "binfile:" & the effective fileName of this stack ) into URL ("binfile:" & nVers & fname)
set the folder to curfolder #revert back to the original folder
pass saveStackRequest -- or the stack won't be saved
end saveStackRequest
#####END OF CODE#####
I want to share this code with you. Place it in your mainstack and you'll have always all version backups in a separate folder:

########CODE#######
on saveStackRequest
put the folder into curfolder #save where are we now
set itemDel to "/"
set the folder to item 1 to -2 of (the effective fileName of this stack)
put item -1 of the filename of this stack into fname #just the name
if (fname & "_vers") is not among the lines of the folders then
create folder (fname & "_vers")
end if
set the folder to (the folder & "/" & fname & "_vers")
put the number of lines of the files into nVers
put URL ( "binfile:" & the effective fileName of this stack ) into URL ("binfile:" & nVers & fname)
set the folder to curfolder #revert back to the original folder
pass saveStackRequest -- or the stack won't be saved
end saveStackRequest
#####END OF CODE#####