saves and shutdowns

rand valentine jrvalent at
Sun Oct 26 09:38:57 CST 2003

 Hi, everyone. I'm using rev 2.1.1 with mac os x (jaguar) and trying to make
a simple data collection application. Basically I have the data saved in
textfiles, which are loaded into the stack when the stack is opened. When
the user quits, I want to save the updated information back into the

 A couple of points. To load the textfiles, I locate them using the
following script in the preOpenStack of the data collection stack. The
textfiles are in a folder called "data" which is in the same folder as the
data collection stack. In the following, "this stack" refers to the data
collection stack

on preOpenStack
  put the effective filename of this stack into thePath
  set the itemDelimiter to "/"
  delete last item of thePath
  put "/data" after thePath
  set the defaultFolder to thePath
  put url "file:wordlist" into fld "wordlist"
  put url "file:sentences" into fld "savedSentences"
  put url "file:settings" into theSettings
end preOpenStack

  Now when I try to trap the user's quitting with

on shutdownRequest
  (save the collected information to the textfiles)
  pass shutdownRequest
end shutdownRequest


on shutdown
  (save the collected information to the textfiles)
end shutdown

  neither of these results in the files being saved.

-- However, if i put the following:

on closeStack
  (save the collected information to the textfiles)
end closeStack

  then it works.

Here are my questions:

1. Why can't I effectively trap a shutdown request?

2. When I make the stack into an application, does the "closeStack" function
still apply to the application file's quitting? I mean, it's not a "stack"
anymore, right?

3. How come, even when I use a closeStack handler and successfully save the
information to textFiles, I have to click on the filenames in the Finder in
order for the proper (new) modification time of the saved textfile to show
up in the Finder?


rand valentine


More information about the use-livecode mailing list