Unable to get saved preferences file into a standalone at launched

charles61 cszasz at mac.com
Sat Jul 24 10:33:44 EDT 2010


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.



More information about the use-livecode mailing list