I've written an application that downloads some information from the web 
that it needs to store, and perhaps later update. To do this, the 
application uses a stack external to itself. The external stack gets 
modified and saved. To make the application self-contained and robust, it 
stores a template of this external stack as a substack, and uses the 
substack to create the external stack if need be. This works very well. 
(Thanks, MetaCard!) I have two questions, based on the following code in 
the script of the first card of the application's main stack:

on preOpenStack
  set the loc of this stack to the screenloc
end preOpenStack

on openStack
  send "goPrefs" to me in 2 seconds  --the application's first card is a 
splash screen
end openStack

on goPrefs
  put the directory & "/prefs.mc" into theStackFile --get the expected 
path
  lock screen
  if there is a file theStackFile then --is the file there?
    close this stack --if so, just get out of the way
    go stack theStackFile --and open the external stack with its own 
parameters
  else
    clone stack "prefsTemplate" --otherwise, clone the template substack
    set the name of it to "prefs" --give it a unique name
    save stack "prefs" as theStackFile --save it to the external file
    go stack theStackFile in window of this stack --open in the splash 
screen's window
  end if
  unlock screen
end goPrefs

Question #1: is this the best way to do this? I think I remember someone 
saying I should name the external something other than *.mc so it won't 
be double-clickable; anything else?

Question #2: if I'm creating the external for the first time, I want it 
to start in the window of the splash screen. However, despite the lock 
screen message, I still see the clone stack appear offset from the splash 
screen, before it hops into the splash screen's position. Is there any 
way to do this better, without the shifting window bit?

Thanks

gc

Reply via email to