Saving standalone substacks

Kay C Lan lan.kc.macmail at gmail.com
Wed Dec 16 20:42:27 EST 2009


On Thu, Dec 17, 2009 at 2:20 AM, J. Landman Gay <jacque at hyperactivesw.com>wrote:

>
> Assuming three stacks in the same folder as your standalone, with the
> defaultfolder set to that directory:
>
> on shutdownRequest
>  repeat for each item i in "stack1.rev,stack2.rev,stack3.rev"
>    save stack i
>    close stack i
>  end repeat
>  pass shutdownRequest
> end shutdownRequest
>
>
Jim,

Because I can never  figure out the differences between Windows set ups and
Mac set ups, to lazy to keep track of the defaultFolder or whether I should
be using a specialFolder, and am sure that someone (me most likely) is
inadvertantly going to move a data stack to another location other than
where my splash stack expects it to be, I've gone for a univeral, seems to
work everytime, calculate the file path exactly before you need it approach:


put the long name of stack "myDataStack" into tFilePath
--result is the full file path enclosed in quotes and preceded by the word
stack
--the first 7 char are: stack "
--the last char is: "
put char 8 to -2 of tFilePath into tFilePath --just the file path
save stack "myDataStack" as tFilePath

So if you have multiple data stacks, using Jacque's example above:

on shutdownRequest
 repeat for each item i in "stack1.rev,stack2.rev,stack3.rev"
  put the long name of stack i into tFilePath
  put char 8 to -2 of tFilePath into tFilePath
  save stack i as tFilePath
  close stack i
 end repeat
 pass shutdownRequest
end shutdownRequest

adds only two lines of code here but seems to save me a whole lot of
headscratching trying to deal with any other approach.

HTH



More information about the use-livecode mailing list