Results 1 to 14 of 14

Thread: Scar using some kind of database?

  1. #1
    Join Date
    Aug 2011
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default Scar using some kind of database?

    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.

  2. #2
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    TStringList, TDataSet

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  3. #3
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    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.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  4. #4
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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.
    The truth finally came out...


  5. #5
    Join Date
    Aug 2011
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    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.

  6. #6
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I supposed SaveSetting and LoadSetting would be the easiest.

  7. #7
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    TStringList.SaveToFile

    TDataSource.SaveToFile? (idk about this one...)

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  8. #8
    Join Date
    Aug 2011
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

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

  9. #9
    Join Date
    Jan 2011
    Location
    Denver, CO
    Posts
    1,351
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by StevenV View Post
    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

  10. #10
    Join Date
    Aug 2011
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    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

  11. #11
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    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.

    Quote Originally Posted by StevenV View Post
    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.

  12. #12
    Join Date
    Aug 2011
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    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?

  13. #13
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    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

  14. #14
    Join Date
    Aug 2011
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •