Unable to get saved preferences file into a standalone at launched

charles61 cszasz at mac.com
Sat Jul 24 12:00:40 EDT 2010


Mike,

Thanks for your explanation and suggestion. I will take a look at this and see what modifications I need to make it work. Thanks again!

Charles Szasz
cszasz at mac.com




On Jul 24, 2010, at 11:58 AM, Mike Bonner [via Runtime Revolution] wrote:

> After glancing through your description of the problem, I believe you 
> gave yourself the answer.  You said that when you launch your app, the 
> prefs aren't loaded until you manually open and then close the prefs 
> stack. This is because you have the call to do so in the prefs stack 
> itself and unless you open it, the preopenstack handler in it doesn't 
> fire.  You open the prefs stack, and viola' it fires and everything is 
> peachy. 
> 
> I'm not sure its the best way, but if you have a preopenstack handler 
> in your app stack, and have it check for a preferences file and do the 
> load itself, then the problem should be solved.  If the preferences 
> file doesn't exist, load the preferences stack, get the user to fill 
> it in, and when the prefs are saved, tell the appstack to try and 
> reload the preferences file. 
> 
> On Sat, Jul 24, 2010 at 8:33 AM, charles61 <[hidden email]> wrote:
> 
> > 
> > I have two stacks: a splash and an app stack (S504). I have a stack "prefs" 
> > which is part of the app stack. The Prefs stack is not moved out as a 
> > separate stack when the standalone is made. I used an installer to install 
> > my program in the AllUsersAppData directory for windows Xp. 
> > 
> > When I run the installed Window app, I open the Prefs stack and entered 
> > information into six fields: myCounty, school system, site, agent, contact 
> > and email. I closed the Prefs stack and then quit my app. When I relaunched 
> > my app, the fields cited above are not filled in my app. But I open the 
> > Prefs stack, the fields are filled in. When I closed the Prefs stack, then 
> > the fields in my app are filled. 
> > 
> > I would appreciate suggestions on how I can get my preferences into my app! 
> > 
> > I have the following script in my Prefs stack: 
> > 
> > on preOpenStack 
> >   set the loc of me to the loc of stack "S504" 
> >   loadPrefs 
> > end preOpenStack 
> > 
> > on closeStack 
> >   saveprefs 
> > end closeStack 
> > 
> > on loadPrefs pFilename 
> >   local tPrefs 
> > 
> >   --   put url ("binfile:" & pFilename) into tPrefs 
> >   IF the platform is "MacOS" 
> >   then 
> >      put url ("binfile:" & specialFolderPath("preferences") & "/" & 
> > "S504_prefs") into tPrefs 
> >   end if 
> > 
> >   IF the platform is "win32" 
> >   then 
> >      put url ("binfile:" & specialFolderPath(26) & "/" & "S504_prefs") into 
> > tPrefs 
> >   end if 
> > 
> >   put arrayDecode(tPrefs) into tPrefs 
> > 
> >   -- now fill in all my data... 
> >   put tPrefs["county"] into field "myCounty" of card id 1002 of stack 
> > "prefs" 
> >   put tPrefs["county"] into field "school system" of card "referral" of 
> > stack "S504" 
> >   --   put tPrefs["county"] into field "site" of card "adult" of stack 
> > "S504" 
> > 
> >   put tPrefs["school"] into field "mySchool" of card id 1002 of stack 
> > "prefs" 
> >   put tPrefs["school"] into field "school" of card "referral" of stack 
> > "S504" 
> >   put tPrefs["school"] into field "site" of card "adult" of stack "S504" 
> > 
> >   put tPrefs["agent"] into field "agent" of card id 1002 of stack "prefs" 
> >   put tPrefs["agent"] into field "agent" of card "letter" of stack "S504" 
> >   put tPrefs["agent"] into field "agent" of card "adult letter" of stack 
> > "S504" 
> > 
> >   put tPrefs["contact"] into field "contact" of card id 1002 of stack 
> > "prefs" 
> >   put tPrefs["contact"] into field "contact" of card "letter" of stack 
> > "S504" 
> >   put tPrefs["contact"] into field "contact" of card "adult letter" of 
> > stack "S504" 
> > 
> >   put tPrefs["email"] into field "email" of card id 1002 of stack "prefs" 
> >   put tPrefs["email"] into field "email" of card "letter" of stack "S504" 
> >   put tPrefs["email"] into field "email" of card "adult letter" of stack 
> > "S504" 
> > end loadPrefs 
> > 
> > on savePrefs pFilename 
> >   local tPrefs 
> > 
> >   --Fill in all of my data 
> >   put field "myCounty" into tPrefs["county"] 
> >   put field "mySchool" into tPrefs["school"] 
> >   put field "agent" into tPrefs["agent"] 
> >   put field "contact" into tPrefs["contact"] 
> >   put field "email" into tPrefs["email"] 
> > 
> >   IF the platform is "MacOS" 
> >   then 
> >      put arrayEncode(tPrefs) into url ("binfile:" & 
> > specialFolderPath("preferences") & "/" & "S504_prefs") 
> > 
> >   end if 
> > 
> >   IF the platform is "win32" 
> >   then 
> >      put arrayEncode(tPrefs) into url ("binfile:" & specialFolderPath(26) & 
> > "/" & "S504_prefs") 
> > 
> >   end if 
> > 
> > end savePrefs 
> > -- 
> > View this message in context: http://runtime-revolution.278305.n4.nabble.com/Unable-to-get-saved-preferences-file-into-a-standalone-at-launched-tp2301100p2301100.html
> > Sent from the Revolution - User mailing list archive at Nabble.com. 
> > _______________________________________________ 
> > use-revolution mailing list 
> > [hidden email] 
> > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: 
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
> _______________________________________________ 
> use-revolution mailing list 
> [hidden email] 
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences: 
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 
> View message @ http://runtime-revolution.278305.n4.nabble.com/Unable-to-get-saved-preferences-file-into-a-standalone-at-launched-tp2301100p2301134.html 
> To unsubscribe from Unable to get saved preferences file into a standalone at launched, click here.
> 


-- 
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Unable-to-get-saved-preferences-file-into-a-standalone-at-launched-tp2301100p2301136.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list