SRL Archive - General

Scar using some kind of database?


StevenV

2011-08-10 11:48:24

hello,

i'm trying to make a program which uses forms,
but i want scar to store the text filled in the forms,
in such a way, that scar can use that text again, even after my computer has been shut down.
So i would like scar to make some sort of database or file in which it stores information an which scar can use to get information to use during the script.

Dgby714

2011-08-10 11:49:49

TStringList, TDataSet

Wizzup?

2011-08-10 12:30:28

In Simba, you can use script settings. (They write XML to the settings.xml)
Support for SQLite or similar is planned. Or you can write to INI files.

mat_de_b

2011-08-10 12:48:37

You can make a text file then save each thing as the next part in an array.

However each time you replay the script it will have to open and change. if not read,copy,re-create.

I'm not sure how easy that is and what processes are used but i know its possible. Its definitely possible using your own server that you can files to and from.

StevenV

2011-08-10 13:33:21

TStringList, TDataSet,
i think this data is just temporary, so if you close file the data is gone, or is there a way to make scar save and edit Tstringlist and Tdataset in to an external file so it can recall this file later?

I have been thinking about ini files but i don't really know how this works.

Wanted

2011-08-10 13:42:27

I supposed SaveSetting and LoadSetting would be the easiest.

Dgby714

2011-08-10 16:21:17

TStringList.SaveToFile

TDataSource.SaveToFile? (idk about this one…)

StevenV

2011-08-11 15:48:34

I'm looking into every possibility, but do you know some place where i can find all the command you can use with INIfiles?

Echo_

2011-08-11 16:28:47

From: StevenV
I'm looking into every possibility, but do you know some place where i can find all the command you can use with INIfiles?


WriteINI, ReadINI, DeleteINI:

http://villavu.com/forum/showthread.php?t=28301

StevenV

2011-08-11 16:36:42

Thanks, INI file is what i was searching for, but while is was messing around with it to know how to use it, i notised that if you write multiple lines, made by a new line break, to a variable in an inifile, it only returns the first line if you recal the variable

Freddy1990

2011-08-13 12:33:09

From: Wizzup?
In Simba, you can use script settings. (They write XML to the settings.xml)
Support for SQLite or similar is planned. Or you can write to INI files.


But has no relevance since the question was about SCAR.

From: StevenV
hello,

i'm trying to make a program which uses forms,
but i want scar to store the text filled in the forms,
in such a way, that scar can use that text again, even after my computer has been shut down.
So i would like scar to make some sort of database or file in which it stores information an which scar can use to get information to use during the script.


The final release of SCAR 4 should offer support for one of or both MySQL and SQLLite, alongside XML, JSON and INI. However, currently using Divi I'd use INI files. Though Load-/SaveSetting works fine, it is somewhat limiting since the settings are stored in the script settings file which might be unsafe if you wan't to share the database with other people.

If you're really adventurous, you could use the standard file functions, but that would significantly increase the amount of code you have to write.

StevenV

2011-08-16 03:53:45

I have been testing with INI files and i think it will be the best and easiest way. There is no problem in unsafety, because it's not made to go on the internet and it does not stores passwords and stuff. I just want to create a program which places advertisments on websites to sell used stuff.

But through testing INI files, i noticed, that when you recall a variable with is multiple lined, it only gives the first line.

example:
i let scar store this text in an INI file:
WriteINI('Settings', 'Beschrijving', Tekst, ScriptPath + 'INItest.ini');
hallo,
my name is steven


and i'm testing INI files.

if i go to my INI file, i get this:
[Settings]
Beschrijving=hallo,
my name is steven

and i'm testing INI files.

and when i make scar recall it i get:
ExampleString := ReadINI('Settings','Beschrijving', ScriptPath + 'INItest.ini');

Hallo,

is there a way so if a recall Beschrijving it returns the multiple lined text?

Freddy1990

2011-08-17 08:11:03

Ini files do not normally support multi-line strings, however, you can work around that in various ways. I'd suggest for example replaxing all of the "\" characters in the string with "\\" and then replacing all of the newlines "#13#10" with for example "\". Then when retrieving the string you just reverse this process. This can easily be achieved using regular expressions: http://wiki.scar-divi.com/index.php?title=PregReplace

StevenV

2011-08-18 11:57:25

okey thanks, i worked my way around ;)
my program i'm making is almost finished :)