newbie question
Malte Brill
revolution at derbrill.de
Mon Sep 19 11:20:47 CDT 2005
Hi Nancy,
I´ll try to answer your questions and hope I am clear enough.
What you will have to do is write a preferences file to the users
Harddisc where you can store information. This could be a simple text
file or a stack. The following handler is quite handy for that purpose.
In the stacks script:
on setPrefs
global pathToYourStackNamePrefsFile
switch the platform
case "MacOS"
put specialfolderpath("preferences") into spfp
break
case "Win32"
if word 1 of the systemversion = "NT" then
put specialFolderPath(35) into spfp
else
put specialfolderpath("system") into spfp
end if
break
default
put $Home into spfp
break
end switch
if there is not a folder (spfp & "/yourStackName") \
then create folder (spfp & "/yourStackName")
if there is not a file (spfp & "/yourStackName/preferences.dat") then
create inv stack "preferences.dat"
save stack "preferences.dat" as (spfp &
"/yourStackName/preferences.dat")
end if
put (spfp & "/yourStackName/preferences.dat") into
pathToYourStackNamePrefsFile
end setPrefs
(mind linebreaks if there are any)
This script creates a preferences stack on the users Harddisc. Now you
can start to use that stack to store data about the last position in
your application.
You might do this in a shutDownRequest handler
on shutDownRequest
global pathToYourStackNamePrefsFile
put pathToYourStackNamePrefsFile into thePath
set the uLastCard of stack thePath to the number of this card
save stack thePath
end shutDownRequest
You will need to add this to the openStack script of your stack (or the
first card)
on openstack
global pathToYourStackNamePrefsFile
setPrefs
put pathToYourStackNamePrefsFile into thePath
if the uLastCard of stack thePath is not empty then
put the uLastCard of stack thePath into tLastCard
go cd tLastCard
end if
end openStack
As I am a long time user I may take things for granted in my
explanations sometimes, so if there is anything where I am not clear
enough please ask. :-)
If you want to block unauthorized users from using your application you
might want to implement a registration mechanism. I have a demo stack
in my user space on revOnline.
user: Malte
stack: password generator
If there are any questions left please ask...
Hope that helps,
malte
More information about the education-revolution
mailing list