protect text file

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jon
Posts: 52
Joined: Sat Apr 14, 2007 11:44 am

protect text file

Post by jon » Wed Aug 22, 2012 9:55 am

Hi
Can I protect a txt file thats outside of my standalone so it can't be altered by the user?
Any advice welcome

Many thanks, Jon.
I dare not shake the dew drop from a rose lest I disturb the stars.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: protect text file

Post by shaosean » Wed Aug 22, 2012 10:07 am

Most operating systems will allow you to make the file read-only, but you would have to configure it on each system.. The other option is to include it in the application..

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: protect text file

Post by FourthWorld » Wed Aug 22, 2012 3:06 pm

You might consider using the encrypt and decrypt functions.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jon
Posts: 52
Joined: Sat Apr 14, 2007 11:44 am

Re: protect text file

Post by jon » Wed Aug 22, 2012 3:17 pm

Thank you both,
I'll look at both options

Regards, Jon
I dare not shake the dew drop from a rose lest I disturb the stars.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: protect text file

Post by bangkok » Wed Aug 22, 2012 4:51 pm

jon wrote:Hi
Can I protect a txt file thats outside of my standalone so it can't be altered by the user?
Any advice welcome
What is inside this text file ?

Internal data used by your app ?

If it's the case, do you really need a text file ? You could put those data in a custom property, within a sub stack (that way, your app could "save" the data).

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: protect text file

Post by FourthWorld » Wed Aug 22, 2012 4:57 pm

bangkok wrote:
jon wrote:You could put those data in a custom property, within a sub stack (that way, your app could "save" the data).
Roger that.

Stack files make a great storage container, since the syntax for working with custom props is simple and robust, and you'll never have to worry about parsing.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jon
Posts: 52
Joined: Sat Apr 14, 2007 11:44 am

Re: protect text file

Post by jon » Wed Aug 22, 2012 5:27 pm

Thanks guys

custom props are a bit over my head at the moment, but I would like some ideas of how please

I am simply needing to save 3 flds with text in them so they appear when I re-start my stand alone game.

Any pointers or psuedo code would be most welcome, thanks for taking your time to help.

By the way I got my txt file to encrypt, but I can't seem to get it to decrypt on import.

Regards, Jon.
I dare not shake the dew drop from a rose lest I disturb the stars.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: protect text file

Post by mwieder » Wed Aug 22, 2012 5:45 pm

Jon- np: here's an development-time example example of putting text into a custom property which I'll call uGreeting.

Code: Select all

put "hello, sailor" into field 1
set the uGreeting of this stack to field 1
then at runtime in your code when you need the text, just retrieve it from the custom property:

Code: Select all

put the uGreeting of this stack into field 1

jon
Posts: 52
Joined: Sat Apr 14, 2007 11:44 am

Re: protect text file

Post by jon » Wed Aug 22, 2012 5:52 pm

Hey thanks mwieder

You just made my day, I had no idea it was so straightforward, the flippin dictionary should be re written by you guys :)

Many thanks again, Jon

PS. How did you know I was a sailor :oops:
I dare not shake the dew drop from a rose lest I disturb the stars.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: protect text file

Post by jacque » Wed Aug 22, 2012 11:39 pm

Except be careful if the text will change. Standalones can't save changes to themselves so anything you put into that property during run time will be lost. If the text is static and is only set during development, you're fine.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: protect text file

Post by FourthWorld » Thu Aug 23, 2012 2:19 am

...or just use a stack file not attached to your standalone.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

LittleGreyMan
Posts: 49
Joined: Sat Jun 16, 2012 7:57 pm

Re: protect text file

Post by LittleGreyMan » Thu Aug 23, 2012 12:03 pm

jon wrote:You just made my day, I had no idea it was so straightforward, the flippin dictionary should be re written by you guys :)
Hi Jon,

The Dictionary is not so bad, but it won't help you catching the spirit of LC and discovering this kind of feature.

Reading the user manual (from the help menu) is really useful.
Best regards,

Didier

jon
Posts: 52
Joined: Sat Apr 14, 2007 11:44 am

Re: protect text file

Post by jon » Thu Aug 23, 2012 4:57 pm

Thanks for your advice

I have decided to go with the external stack, password protected because the data in the flds changes all the time.

I allways learn and sometimes get side tracked after the advice i get on here, but in a good way. :)

Thanks again all, Jon
I dare not shake the dew drop from a rose lest I disturb the stars.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: protect text file

Post by Klaus » Thu Aug 23, 2012 5:13 pm

jon wrote:PS. How did you know I was a sailor :oops:
:D :D :D

Post Reply